16 条题解
-
2
#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; }
-
0
#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; }
-
-1
#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; }
- 1
信息
- ID
- 871
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 7
- 标签
- 递交数
- 1742
- 已通过
- 349
- 上传者