6 条题解

  • 0
    @ 2025-8-5 11:03:42

    还是十分简单啊...

    要注意 x=0 的情况,不需要输出,直接 return 0 即可:

    #include<iostream>
    #include<cmath>
    #include<algorithm>
    #define QwQ return 0;
    using namespace std;
    int n,x,y;
    int main(){
    	cin>>n>>x>>y;
    	if(x==0){
    		QwQ
    	}
    	cout<<max(n-ceil(y*1.0/x),0.0);
    	QwQ
    }
    
    • 0
      @ 2025-2-26 16:35:32

      n,x,y=input().split() n=int(n) x=int(x) y=int(y) eat=0 if y%x!=0: eat=(y-(y%x))/x+1 else: eat=y/x print(int(n-eat))

      • 0
        @ 2024-12-28 11:46:10
        #include<bits/stdc++.h>
        using namespace std;
        int n,x,y;
        signed main(){
        	cin>>n>>x>>y;
        	if(x==0)return 0;
        	else cout<<n-ceil(y*1.0/x);
        }
        
        • 0
          @ 2024-12-27 21:30:24

          蒙掉了,五个测试点有 44 个空白代码都有分。然后呢?我的“正解”交上去只对了一个点。

          #include<bits/stdc++.h>
          #define int long long
          #define INF 0x3f3f3f
          using namespace std;
          int n,x,y;
          signed main(){
          	cin>>n>>x>>y;
          	if(x==0);//应该是输出 0 才对啊
          	else if(y%x==0)cout<<n-y/x;
          	else cout<<n-y/x-1;
          	return 0;
          }
          
          • 0
            @ 2024-12-24 21:10:18

            警示后人:你谷代码都没过,直接看官解:不是哥们,为什么 x=0x=0 的时候它直接要 return 0; 啊!!!

            #include<bits/stdc++.h>
            using namespace std;
            int main(){
                int m,t,s;
                cin>>m>>t>>s;
                if(t==0)
                {
            		return 0;
            	}
            	else
            	{
            		cout<<max(m-int(ceil(s*1.0/t)),0);
            	}
            	return 0;
            }
            
            • -1
              @ 2024-12-22 11:03:53

              C++ :

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

              Python :

              # coding=utf-8
              n,x,y = input().split ()
              n = int (n)
              x = int (x)
              y = int (y)
              a = int (y / x)
              print (y - a)
              
              • 1

              信息

              ID
              19
              时间
              1000ms
              内存
              128MiB
              难度
              6
              标签
              (无)
              递交数
              177
              已通过
              58
              上传者