1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ long long n; cin >> n; //贪心思想,要最少,那么我们优先用7CM的。 long long ans = n / 7; int tmp = n % 7; //计算剩下的 while(ans >= 0){ if (tmp % 4 == 0) { cout << ans + tmp/4; return 0; } ans--; tmp += 7; } cout << -1; return 0; }
- 1
Information
- ID
- 446
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By