6 solutions

  • 4
    @ 2024-1-27 11:01:44
    #include<iostream>
    #include<iomanip>
    #include<cmath>
    using namespace std;
    long a,b,n;
    int main(){
    	cin>>a>>b>>n;
    	for(int i=1;i<=n;i++) a%=b,a*=10;
    	cout<<a/b<<"\n";
    	return 0;
    }
    

    要边循环边mod,不然爆0

    • 2
      @ 2023-9-17 21:30:23
      #include <iostream>
      using namespace std;
      int a,b,n,i;
      int main(){
      	cin>>a>>b>>n;
      	for(i=1;i<=n;++i) a%=b,a*=10;
      	cout<<a/b;
      	return 0;
      }
      
      • 0
        @ 2024-7-10 17:27:02

        #include<iostream>
        #include<iomanip>
        #include<cmath>
        using namespace std;
        long a,b,c;
        int main(){
        	cin>>a>>b>>c;
        	for(int i=1;i<=c;i++) {
                a%=b,a*=10;
            }
        	cout<<a/b;
        	return 0;
        }
        
        
        • 0
          @ 2024-7-10 17:26:43
          #include<iostream>
          #include<iomanip>
          #include<cmath>
          using namespace std;
          long a,b,c;
          int main(){
          	cin>>a>>b>>c;
          	for(int i=1;i<=c;i++) {
                  a%=b,a*=10;
              }
          	cout<<a/b;
          	return 0;
          }
          
          
          • 0
            @ 2023-9-16 16:23:24

            #include<bits/stdc++.h> using namespace std; int main(){ int a,b,n,i; cin>>a>>b>>n; for(i=1;i<=n;++i){ a%=b; a*=10; } a/=b; cout<<a; return 0; }``

            • -1
              @ 2023-9-17 20:58:22

              #include <bits/stdc++.h> using namespace std; int a,b,n,c=0; int main(){ scanf("%d %d %d",&a,&b,&n); for(int i=0;i<n;i++){ a*=10; c=a/b; a%=b; } printf("%d",c); return 0; }

              • 1

              Information

              ID
              572
              Time
              1000ms
              Memory
              256MiB
              Difficulty
              5
              Tags
              # Submissions
              190
              Accepted
              72
              Uploaded By