Codeforces #362 div2 prob697 没有题解= =
来源:互联网 发布:nginx内置变量详解 编辑:程序博客网 时间:2024/06/05 10:30
这套题有点懒得写题解了,,,看代码基本上都能看懂,,,,
697A:Pineapple Incident
#include <cstdio>int t, x, s;int main () { scanf("%d %d %d", &t, &s, &x); if (x < t) printf("NO"); else if (x == t) printf("YES"); else if (x > t && x < t + s) printf("NO"); else { int cur = (x - t) % s; if (cur == 0 || cur == 1) printf("YES"); else printf("NO"); } return 0;}
697B:Barnicle:
#include <cstdio>#include <cstring>#include <algorithm>char s[1010000];bool f = 0; // f = 1 means a is realint cur = 0;int cure = 0;int b;int main () { gets(s); int len = strlen(s); for (int i = 0; i < len; i++) { if (s[i] == '.') { f = 1; cur = i; } if (s[i] == 'e') { cure = i; } } b = atoi(&s[cure+1]); if (b == 0) { if (s[cur+1] == '0' && s[cur+2] == 'e') { for (int i = 0; i < cur; i++) printf("%c", s[i]); exit(0); } for (int i = 0; i < cure; i++) printf("%c", s[i]); exit(0); } // printf("%d", b); if (cure - cur - 1 > b) { int k = cur + b; int ttt = k; for (int i = 0; i <= k; i++) if (s[i] != '0' && s[i] != '.') { ttt = i; break; } for (int i = ttt; i <= k; i++) if (s[i] >= '0' && s[i] <= '9') printf("%c", s[i]); printf("."); for (int i = k + 1; i < cure; i++) printf("%c", s[i]); } else { int ttt = 0; for (int i = 0; i < cure; i++) { if (s[i] != '0' && s[i] != '.') { ttt = i; break; } } for (int i = ttt; i < cure; i++) if (s[i] >= '0' && s[i] <= '9') printf("%c", s[i]); int k = b - cure + cur + 1; while (k--) printf("0"); } return 0;}
697C:Lorenzo Von Matterhorn:
#include <cstdio>#include <cstring>#include <algorithm>#include <map>std :: map<long long, long long> mp;int q;int od;long long x, y, z;void change(long long x, long long y, long long z) { if (x < y) std :: swap(x, y); while (x != y) { mp[x] += z; x = x >> 1; if (x < y) std :: swap(x, y); }}long long xfind(long long x, long long y) { long long ans = 0; if (x < y) std :: swap(x, y); while (x != y) { ans += mp[x]; x = x >> 1; if (x < y) std :: swap(x, y); } return (ans);}int main () { scanf("%d", &q); for (int i = 1; i <= q; i++) { scanf("%d %I64d %I64d", &od, &x, &y); if (od == 1) { scanf("%I64d", &z); change(x, y, z); } else { printf("%I64d\n", xfind(x, y)); } } return 0;}
1 0
- Codeforces #362 div2 prob697 没有题解= =
- Codeforces 241 div2题解
- Codeforces Round330 Div2题解
- Codeforces #370(div2)题解
- codeforces #371(Div2)题解
- codeforces #373 div2题解
- codeforces round 169 div2 题解
- codeforces 187 (div2)题解
- Codeforces Round #214div2题解
- codeforces Round #215 div2 题解
- codeforces round229 div2 前三题题解
- Codeforces Round #265(div2)题解
- codeforces round 291 div2 题解
- codeforces round 299 div2 题解
- Codeforces Round 313 div2 题解
- codeforces round 315 div2 题解
- codeforces round 319 div2 题解
- Codeforces Round #320 div2 题解
- 分布式服务框架 Zookeeper -- 管理分布式环境中的数据
- STM32---TIM
- Cas集群中对于tgt使用redis共享的操作
- PHP cookie存放数组
- php钩子和简单的分发方式
- Codeforces #362 div2 prob697 没有题解= =
- MFC不同dll中对话框的调用问题
- 5前期异常捕获
- Spring Batch 整理
- 解决IIS7.5 IIS8下的discuzX3.2伪静态问题
- STL-vector
- Source Insight 3.X 插件支持utf8,完美解决中文乱码,另附优美的配置文件一份
- 协作式多任务操作系统
- DB2操作生产实例