16 条题解
-
1邓梓昊 LV 7 @ 2024-11-20 13:26:19
#pragma GCC optimize(3) #pragma GCC target("avx") #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("-fwhole-program") #pragma GCC optimize("-freorder-blocks") #pragma GCC optimize("-fschedule-insns") #pragma GCC optimize("inline-functions") #pragma GCC optimize("-ftree-tail-merge") #pragma GCC optimize("-fschedule-insns2") #pragma GCC optimize("-fstrict-aliasing") #pragma GCC optimize("-fstrict-overflow") #pragma GCC optimize("-falign-functions") #pragma GCC optimize("-fcse-skip-blocks") #pragma GCC optimize("-fcse-follow-jumps") #pragma GCC optimize("-fsched-interblock") #pragma GCC optimize("-fpartial-inlining") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("-freorder-functions") #pragma GCC optimize("-findirect-inlining") #pragma GCC optimize("-fhoist-adjacent-loads") #pragma GCC optimize("-frerun-cse-after-loop") #pragma GCC optimize("inline-small-functions") #pragma GCC optimize("-finline-small-functions") #pragma GCC optimize("-ftree-switch-conversion") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("-funsafe-loop-optimizations") #pragma GCC optimize("inline-functions-called-once") #pragma GCC optimize("-fdelete-null-pointer-checks") #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define int long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int a, b, c, ans; signed main() { scanf("%lld %lld %lld", &a, &b, &c); ans = a - (int)(c / b); if(c % b)//判断时间结束时虫子是否不是刚好吃完一个苹果 ans--; if(ans < 0)//ans值可能小于0,但是剩下的苹果数量不可能为0 ans = 0; printf("%lld" , ans); return 0; }
纯享版:
#include <stdio.h> #define int long long int a, b, c, ans; signed main() { scanf("%lld %lld %lld", &a, &b, &c); if(!(c % b)) ans = a - (int)(c / b); else ans = a - (int)(c / b) - 1; if(ans < 0) ans = 0; printf("%lld" , ans); return 0; }
-
02023-10-25 22:21:11@
#include <bits/stdc++.h> #include <iostream> #include <iomanip> #include <cmath> #include <math.h> #include <algorithm> #include <cstring> using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int main() { int n , x , y , c; cin >> n >> x >> y; c = y / x; if( y % x > 0 ) { if( n - c < 0 ) { cout << 0 << endl; } else { c = c + 1; c = n - c; cout << c << endl; } } else { if( n - c < 0 ) { cout << 0 << endl; } else { c = n - c; cout << c << endl; } } return 0; }
-
02023-5-11 18:04:15@
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,x,y,s;
cin>>n>>x>>y;
s=n-ceil(y*1.0/x);
if(s<0)
{
s=0;
}
cout<<s;
return 0;
}
-
02023-3-18 21:37:24@
#include<iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c; d=c/b; if(c%b!=0) ; { d=d+1; } if(a-d<=0){ cout<<"0"; }else{ cout<<a-d; } return 0; }
-
-12024-6-4 21:30:41@
#include<cmath> using namespace std; int main() { int n,x,y; cin>>n>>x>>y; int d=n-ceil(y*1.0/x); if(d<0){d=0;} cout<<d; return 0; }
-
-12024-4-6 9:34:50@
#include<bits/stdc++.h> using namespace std; int const N=1e5+10; double n,x,y; int main(){ cin>>n>>x>>y; int ans=n-y/x; if(ans<=0){ cout<<"0"; return 0; } cout<<ans; return 0; }
-
-12023-3-18 21:37:32@
#include<iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c; d=c/b; if(c%b!=0) ; { d=d+1; } if(a-d<=0){ cout<<"0"; }else{ cout<<a-d; } return 0; }
-
-12023-3-18 21:37:20@
#include<iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c; d=c/b; if(c%b!=0) ; { d=d+1; } if(a-d<=0){ cout<<"0"; }else{ cout<<a-d; } return 0; }
-
-12023-3-18 21:37:12@
#include<iostream> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c; d=c/b; if(c%b!=0) ; { d=d+1; } if(a-d<=0){ cout<<"0"; }else{ cout<<a-d; } return 0; }
-
-12022-12-7 22:19:35@
#include<iostream> using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c; d=c/b; if(c%b!=0){ d++;//注意题目要求求完整的苹果 } if(a-d<=0){ cout<<"0";//注意苹果不低于0 }else{ cout<<a-d; } }
-
-12022-3-30 21:16:11@
#include<iostream>
using namespace std;
int main(){
int a,b,c,d; cin>>a>>b>>c; d=c/b; if(c%b!=0){ d++;//注意题目要求求完整的苹果 } if(a-d<=0){ cout<<"0";//注意苹果不低于0 }else{ cout<<a-d; }
}
-
-12022-1-6 14:04:27@
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int main() { int n ,x,y; cin >> n >> x >> y; n = n - y/x; if(y%x != 0) { n -= 1; } if(n < 0) n = 0; cout << n; }
-
-22022-1-3 12:03:02@
#include <iostream> #include <math.h> #include <iomanip> using namespace std; int main() { double n,x,y; cin>>n>>x>>y; int s=n-(y/x); if(s<0) s=0; cout<<s; }
-
-42023-3-4 9:23:21@
-
-42022-7-2 20:00:05@
#include<stdio.h> #include<iostream> using namespace std; int main() { int n,x,y; cin>>n>>x>>y; if(y%x==0) { int a=y/x; if(n-a<=0) { cout<<0<<endl; }else { cout<<n-a<<endl; } }else { int b=y/x+1; if(n-b<=0) { cout<<0<<endl; }else { cout<<n-b<<endl; } } }
-
-42022-1-24 13:18:40@
#include<iostream> using namespace std; int main() { int n,x,y,cnt; cin>>n>>x>>y; if(y/x==0)cnt=1; //要完整的苹果,所以至少为一 else cnt =y/x+1; //理由同上 if(n-cnt<=0)cout<<0; //苹果不可能比零个少 else cout<<n-cnt; return 0; }
- 1
信息
- ID
- 871
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 1460
- 已通过
- 313
- 上传者