3 solutions

  • 4
    @ 2025-5-24 9:26:30
    #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;
    }
    
    • 1
      @ 2026-8-14 13:41:11
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a,b,c;
      	cin>>a>>b>>c;
      	int cnt=0;
      	for(int i=0;i<=c;i++)
      	{
      		for(int j=0;j<=c;j++)
      		{
      			if(i*a+j*b==c)
      			{
                      cnt++;
      			}
      		}
      	}
      	cout<<cnt;
      	return 0; 
      }
      
      • -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;
        }
        • 1

        Information

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