3 solutions

  • -1
    @ 2026-8-13 21:53:01
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int a,b,c;
    	cin>>a>>b>>c;
    	int cnt=0;
    	for(int x=0;x<=c;x++)
    	{
    		for(int y=0;y<=c;y++)
    		{
    			if(a*x+b*y==c)
    			{
    				cnt++;
    			}
    		}
    	}
    	cout<<cnt;
    	return 0;
    }

    Information

    ID
    592
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    111
    Accepted
    57
    Uploaded By