codeforces 333A - Secrets
2013-07-27 20:56
351 查看
题意:保证不能正好配齐n,要求输出可以用的最大硬币数。
注意如果用到某种硬币,那么这种硬币就有无穷多个。所以11=3+3+3+3,12=9+9,13=3+3+3+3+3
View Code
注意如果用到某种硬币,那么这种硬币就有无穷多个。所以11=3+3+3+3,12=9+9,13=3+3+3+3+3
#include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> using namespace std; #define LL __int64 int main() { LL n,tot=3; scanf("%I64d",&n); while(1) { if(n%tot){ printf("%I64d\n",n/tot+1); break; } tot*=3; } return 0; }
View Code
相关文章推荐
- 【codeforces 333A】 - Secrets
- 【CodeForces 333A】Secrets(模拟)
- CodeForces-333A-Secrets
- Codeforces 173B Chamber of Secrets 题解
- Codeforces Problem 333A - Secrets
- CodeForces - 173B Chamber of Secrets
- CodeForces 173B Chamber of Secrets 二分图+最短路
- CodeForces 173B Chamber of Secrets(最短路)
- CodeForces - 333A
- CodeForces 173B Chamber of Secrets spfa
- CodeForces 333A
- CodeForces 173B Chamber of Secrets (二分图+BFS)
- codeforces 453B Little Pony and Harmony Chest (离散化+dp状态压缩)
- Codeforces - AIM Tech Round (Div. 2)C - Graph and String
- CodeForces 706C Hard problem (水DP)
- codeforces 779D 二分
- codeforces 839D(89/600)
- Filya and Homework CodeForces - 714B
- Codeforces-509-A(c++)
- Codeforces 629C Famil Door and Brackets 【dp】