57 条题解

  • -1
    @ 2023-1-9 20:37:54
    #include<iostream>
    using namespace std;
    int ans;
    int main()
    {
        int x , a , b;
        cin >> x >> a >> b;
        for(int i = 1;i <= (x - b) / a;i++)
        {
            if((x - (i * a)) % b == 0)
            {
                ans++;
            }
        }
    	cout << ans << endl;
        
        
        
        return 0;
    }
    
    </span>
    • @ 2023-4-2 15:35:27

      这位大哥,你for语句里面的if语句是不是多了一个“)”?

    • @ 2023-6-11 10:59:55

      是加了一个(

    • @ 2023-8-6 13:28:40

      没错!

  • -2
    @ 2023-8-21 15:59:58

    用枚举就行了

    主要代码: for (int i=1;i<=(x-b)/a;i++) { if ((x-i*a)%b==0) { num++; } }

    • -2
      @ 2023-8-18 21:33:19

      1

      • -2
        @ 2023-8-8 20:36:36
        #include<iostream>
        using namespace std;
        int main()
        {
            int x,a,b,sum=0;
            cin>>x>>a>>b;
            for(int i=1;i<=(x-b)/a;i++)
            {
                if((x-(i*a))%b==0)
                {
                    sum++;
                }
            }
            cout<<sum;
            return 0;
        }
        
        
        • -2
          @ 2023-8-7 14:27:10
          #include <iostream>
          using namespace std;
          int main()
          { 
              int n, a, b, x = 0;
              cin >> n >> a >> b;
              for (int i = 1; i <= n / a; i++)
              { 
                  if ((n - i * a >= b) and (n - i * a) % b == 0)
                  {
                	    x += 1;
          	    }
              }
              cout << x << endl;
              return 0;
          }
          
          • @ 2023-8-24 19:57:35

            试了好几个同学的方法,只有这个对了...... 不过for循环我试了一下,也可以

        • -2
          @ 2023-8-7 10:26:18

          新手上路,请多关照!

          #include <iostream>
          using namespace std;
          int main()
          { 
              int n, a, b, x = 0;
              cin >> n >> a >> b;
              for (int i = 1; i <= n / a; i++)
              { 
                  if ((n - i * a >= b) && (n - i * a) % b == 0)
                  {
                	    x++;
          	    }
              }
              cout << x << endl;
              return 0;
          }
          
          • -2
            @ 2023-6-4 19:13:34

            #include <iostream> using namespace std; int main() { int x,a,b,sum= 0; cin>>x>>a>>b; for (int i=1;i<=x/a;i++) if ((x-ia>=b) && (x-ia)%b == 0) sum++; cout<<sum<<endl; return 0; }

            • -2
              @ 2023-5-30 20:37:02

              #include <bits/stdc++.h> using namespace std; int main() { int x,a,b,n=0; cin>>x>>a>>b; x=x-b; for(int i=1;i<=x/b;i++) { if(((x+b)-i*b)%a==0) { n++; } } cout<<n; return 0; }

              • -2
                @ 2023-5-27 19:45:24

                #include<iostream> using namespace std; int main() { int x,sum=0,m,n; cin>>x>>m>>n; for(int i=x-m;i>0;i-=m) { if(i%n==0) { sum+=1; } } cout<<sum; }

                • -2
                  @ 2023-4-29 7:33:54

                  for (int i = 1; i <= n / a; i++) { if ((n - i * a >= b) && (n - i * a) % b == 0) { x++; } }

                  
                  
                  
                  
                  • -2
                    @ 2023-3-21 20:29:07

                    呵呵,这题不难,废话不多说,上代码!(就算不是最短的,也肯定会进前三)

                    #include <bits/stdc++.h>
                    using nemespace std;
                    int main()
                    {
                        int x,a,b,sum=0;
                        cin>>x>>a>>b;
                        for (int i=1;i<=x/a;i++)
                        {
                            for (int j=1;j<=x/b;j++)
                            {
                                if (a*i+b*j==x)
                                {
                                    sum++;
                                }
                            }
                        }
                        cout<<sum;
                        retu rn 0;
                    }
                    

                    温馨提示:本人为防复制,在里面加了5处错误,小心不要中计。

                    • -2
                      @ 2023-1-9 19:54:25

                      还是我来发吧。

                      #include<iostream>
                      using namespace std;
                      int ans;
                      int main()
                      {
                          int x , a , b;
                          cin >> x >> a >> b;
                          for(int i = 1;i <= (x - b) / a;i++)
                          {
                              if((x - (i * a)) % b == 0)
                              {
                                  ans++;
                              }
                          }
                      	cout << ans << endl;
                          
                          
                          
                          return 0;
                      }
                      

                      提示:以AC,可以放心食用。

                    • -3
                      @ 2023-8-21 18:21:48

                      image

                      • -3
                        @ 2023-8-16 10:00:59

                        AC过了,放心

                        #include <iostream>
                        using namespace std;
                        int main()
                        {
                            int x,a,b,c = 0;
                            cin >> x >> a >> b;
                            for(int i = 1;i < x / a;i++)
                            {
                                if(x - a * i >= b)
                                {
                                    if ((x - a * i) % b == 0)
                                    {
                                        c++;
                                    }
                                }
                            }
                            cout << c;
                            return 0;
                        }
                        
                        • -3
                          @ 2023-8-5 8:33:04
                          #include <iostream>
                          using namespace std;
                          int main()
                          { 
                              int n, a, b, x = 0;
                              cin >> n >> a >> b;
                              for (int i = 1; i <= n / a; i++)
                              { 
                                  if ((n - i * a >= b) && (n - i * a) % b == 0)
                                  {
                                	    x++;
                          	    }
                              }
                              cout << x << endl;
                              return 0;
                          }
                          
                          • -3
                            @ 2023-3-30 13:27:20
                            int x,a,b,n=0;
                                cin>>x>>a>>b;
                                for (int i=1;i<=(x-b)/a;i++)
                                {
                                    if ((x-(i*a))%b==0)
                                    {
                                        n++;
                                    }
                                }
                                cout<<n;
                            
                            • -33
                              @ 2022-4-24 15:50:16

                              鼓励大家写题解,但注意题解格式。

                              给代码两端加上这个会舒服一些

                              ```cpp

                              你的代码

                              ```

                              </span>

                              这个点在键盘的左上角tab上面那个键,注意切换输入法

                              #include<iostream>
                              using namespace std;
                              int main()
                              {
                                  int n;
                                  cin>>n;//这是一个注释
                                  return 0;
                              } 
                              

                              请注意严禁抄袭题解,写题解不要只放代码,需加上你的思路或代码注释。

                              抄袭题解一经发现直接取消成绩。

                              • @ 2023-3-25 22:43:45

                                !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                              • @ 2023-8-7 14:28:28

                                6666666666666666

                              • @ 2023-8-20 11:32:32

                                老师这不是题解

                            信息

                            ID
                            8
                            时间
                            1000ms
                            内存
                            16MiB
                            难度
                            6
                            标签
                            递交数
                            9637
                            已通过
                            3163
                            上传者