UVa 11636 你好 世界!(贪心)
2017-03-07 23:02
169 查看
https://vjudge.net/problem/UVA-11636
题意:
经过一次复制,一条语句会变成两条语句,再经过一次变成四条语句...求最少需要复制几次能使条数恰好为n?
思路:
贪心水题。
每次以最大复制数复制即可。
题意:
经过一次复制,一条语句会变成两条语句,再经过一次变成四条语句...求最少需要复制几次能使条数恰好为n?
思路:
贪心水题。
每次以最大复制数复制即可。
#include<iostream> #include<algorithm> #include<string> using namespace std; const int maxn = 50 + 5; int n; int main() { ios::sync_with_stdio(false); //freopen("D:\\txt.txt", "r", stdin); int kase = 0; while (cin >> n && n >=0) { int num = 1; int cnt = 0; while (true) { if (num >= n) break; num *= 2; cnt++; } cout << "Case " << ++kase << ": " << cnt << endl; } }
相关文章推荐
- 你好 世界!(Uva 11636)
- UVa11636 - Hello World!(贪心)
- UVA - 11636 Hello World! 贪心水题
- UVA - 11636 Hello World! (贪心)
- 贪心水题。UVA 11636 Hello World,LA 3602 DNA Consensus String,UVA 10970 Big Chocolate,UVA 10340 All in All,UVA 11039 Building Designing
- UVA 11636 (贪心)
- UVA - 11636(贪心)
- UVALive 7483 贪心策略
- UVA 10465 - Homer Simpson 贪心或完全背包
- UVA - 993 Product of digits 贪心
- 【UVa】11636 - Hello World!
- UVA10440->贪心||DP
- UVA 1379 - Pitcher Rotation(DP + 贪心)
- UVa 1346 Songs (贪心好题)
- uva 1346 - Songs(贪心)
- uvalive 4254 Processor处理器 (二分模拟+贪心)
- uva 1346 - Songs(贪心)
- uva1149--贪心
- UVA 10020 - Minimal coverage (贪心) 区间覆盖问题
- UVA 10602 Editor Nottoobad(贪心)