3 条题解

  • 1
    @ 2025-4-20 19:16:43
    #include<bits/stdc++.h>
    using namespace std;
    int main() {
        int a,b,c,d=1;
    	cin>>a>>b>>c;
    	bool e=true;
    	while(e){
    		d++;
    		if(a%d==b%d&&a%d==c%d&&b%d==c%d){
    			e=false;
    		}
    	}
    	cout<<d;
        return 0;
    }
    
    • 0
      @ 2025-2-3 20:41:30
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int a,b,c;
      	cin>>a>>b>>c;
      	for(int x=2;x<=a;x++)
      	{
      	 if(a%x==b%x&&b%x==c%x)
      	 {
      	  cout<<x;
      	  break;
      	 }
      	}
      	return 0;
      }
      
      • -1
        @ 2025-1-20 18:20:37

        一道模拟题...

        #include<bits/stdc++.h>
        using namespace std;
        int main(){
        int a,b,c,x = 2;
        cin >> a >> b >> c;
        while (true){//因为题目保证x有解,所以可以用while(true)
        if (a % x == b % x && b % x == c % x){//判断是否符合条件
        cout << x;
        return 0;
        }
        x = x + 1;
        }
        return 0;
        }
        
        • 1

        信息

        ID
        71
        时间
        1000ms
        内存
        128MiB
        难度
        1
        标签
        (无)
        递交数
        60
        已通过
        41
        上传者