4 solutions

  • 1
    @ 2022-3-18 22:14:28

    我的评价是,直接枚举。

    #include <bits/stdc++.h>
    using namespace std;
    #define ll long long
    
    
    int main()
    {
    	int a,b,c;
    	cin>>a>>b>>c;
    	int ans=0;
    	for(int i = 0; i <= 10000; i++){
    		for(int j = 0; j <= 10000; j++){
    			if(a*i+b*j+c == 0)	ans++;
    		}
    	}
    	cout << ans << endl; 
      	return 0;
    }
    

    Information

    ID
    48
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    316
    Accepted
    115
    Uploaded By