top1编程
← 返回题目
题解

不定方程求解

1 条题解

  • 0
    @ 2026-7-28 22:45:14
    #include<iostream>
    using namespace std;
    int sum;
    int main(){
    	int a,b,c;
    	cin>>a>>b>>c;
    	for(int x=0;x<=c/a;x++){
    		for(int y=0;y<=c/b;y++){
    			if(a*x+b*y-c==0){
    				sum++;
    			}
    		}
    	}
    	cout<<sum;
    }
    
    • 1