4 solutions

  • 0
    @ 2022-1-29 12:28:43

    话说这也可以ac?

    #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() {//输出a*b%c ll a, b, c, ans; while (cin >> a >> b >> c) { ans = a * b % c; cout << ans << endl; } return 0; }

    • 0
      @ 2022-1-3 19:56:16

      嗯同余~~(楼下说写题解加深印象)~~

      #include<stdio.h>
      #include<iostream>
      using namespace std;
      typedef long long ll;
      int main()
      {
      	ll a,b,c,ans;
      	while(cin>>a>>b>>c)
      	{
      		ans=((a%c)*(b%c))%c;
      		cout<<ans<<endl;
      	}
      	return 0;
      }
      
      • 0
        @ 2022-1-3 16:38:00

        标准的同余

        #include<cstdio>
        #include<iostream>
        using namespace std;
        int main(){
        	long long int a,b,c;
        	while(cin>>a>>b>>c){
        		a%=c;
        		b%=c;
        		long long int ans=a*b%c;
        		printf("%lld\n",ans);
            }
            return 0;
        }
        
        • 0
          @ 2022-1-3 11:07:51

          //同余

          #include<bits/stdc++.h>
          using namespace std;
          int main(){
          	long long a,b,c,ans=0;
          	while(scanf("%lld%lld%lld",&a,&b,&c)!=EOF){
          		ans=((a%c)*(b%c))%c;
          			cout<<ans<<endl;
          	}
          	return 0;
          }
          
          • 1

          Information

          ID
          278
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          6
          Tags
          # Submissions
          175
          Accepted
          57
          Uploaded By