标签:play for beginning iostream soft osi case lag contains
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 #include<cmath> 6 #include<vector> 7 #include<set> 8 #include<string> 9 #include<sstream> 10 #include<cctype> 11 #include<map> 12 #include<stack> 13 #include<queue> 14 using namespace std; 15 #define INF 0x3f3f3f3f 16 typedef long long ll; 17 int gcd(int a, int b){return b==0?a:gcd(b,a%b);} 18 19 int m; 20 21 int main() 22 { 23 // freopen("input.txt", "r", stdin); 24 // freopen("output.txt", "w", stdout); 25 int t = 1; 26 while(scanf("%d", &m) != EOF) 27 { 28 cout << "Case #" << t++ << ": " << (int) (log10(2) * m) << endl; 29 } 30 return 0; 31 }
1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 #include<vector> 6 #include<set> 7 #include<string> 8 #include<sstream> 9 #include<cctype> 10 #include<map> 11 using namespace std; 12 #define INF 0x3f3f3f3f 13 14 int main() 15 { 16 // freopen("input.txt", "r", stdin); 17 // freopen("output.txt", "w", stdout); 18 long long n, k; 19 int flag = 0, ans; 20 while(~scanf("%lld%lld", &n, &k)) 21 { 22 if(k <= n) ans = k; 23 else 24 { 25 int x = (k - n) % (2 * (n - 1)); 26 if(x < n && x > 0) ans = x; 27 else if (x == 0) ans = n; 28 else ans = x - n + 1; 29 } 30 printf("Case #%d: %d\n", ++flag, ans); 31 } 32 return 0; 33 }
标签:play for beginning iostream soft osi case lag contains
原文地址:http://www.cnblogs.com/roMxx/p/7274312.html