CF Codeforces Round #162 (Div. 1) A. Escape from Stones
2013-01-21 11:12
501 查看
http://codeforces.com/problemset/problem/264/A
DIV2的C题,话说做了一个小时就回宿舍了,结果还是被楼管阿姨锁在了外边,无语啊。。
就是一个简单的双向链表...模拟插入。 但是只是想着算出1/2 1/4 ...来然后排序,(1/2)^(10^6)啊,不吵数据类型才怪呢。。无语啊。。
DIV2的C题,话说做了一个小时就回宿舍了,结果还是被楼管阿姨锁在了外边,无语啊。。
就是一个简单的双向链表...模拟插入。 但是只是想着算出1/2 1/4 ...来然后排序,(1/2)^(10^6)啊,不吵数据类型才怪呢。。无语啊。。
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <cmath> #include <queue> #include <List> #include <set> #include <map> #include <string> #define CL(a,num) memset((a),(num),sizeof(a)) #define iabs(x) ((x) > 0 ? (x) : -(x)) #define Min(a,b) (a) > (b)? (b):(a) #define Max(a,b) (a) > (b)? (a):(b) #define ll __int64 #define inf 0x7f7f7f7f #define MOD 1073741824 #define lc l,m,rt<<1 #define rc m + 1,r,rt<<1|1 #define pi acos(-1.0) #define test puts("<------------------->") #define maxn 100007 #define M 20007 #define N 1000007 using namespace std; //freopen("din.txt","r",stdin); struct node { int id; node *next,*pre; }*head,*end,*cur; char s ; int main() { scanf("%s",s); head = new node; end = new node; cur = new node; head->next = end; end->pre = head; cur = head; end->next = NULL; int len = strlen(s); for (int i = 0; i < len; ++i) { node *p = new node(); p->id = i + 1; p->next = cur->next; cur->next = p; p->pre = cur; cur->next->pre = p; if (s[i] == 'r') cur = cur->next; } node *q = new node(); for (q = head->next; q != end; q = q->next) printf("%d\n",q->id); return 0; }
相关文章推荐
- cf/Codeforces Round #373 div1-C/div2-E Sasha and Array 线段树 + 维护矩阵快速幂
- Codeforces Round #162 (Div. 2)总结
- CF Codeforces Round #257 (Div. 1) A (449A) Jzzhu and Chocolate
- Codeforces Round #162 (Div. 2) C
- 【Codeforces Round 339 (Div 2)D】【暴力 贪心 二分】Skills 最高技能人数乘cm+最低技能乘cf权值最大
- [CF]codeforces round 369(div2)
- 记一场(伪)CF (Educational Codeforces Round 40 (Rated for Div. 2) )
- 【CF】Codeforces Round #124 (Div. 2) 197A Plate Game
- Codeforces Round #291 (Div. 2) 解题报告 (A B C D)
- Codeforces Round #292 (Div. 2)D. Drazil and Tiles
- Codeforces Round #428 (Div. 2) C. Journey(dfs deep
- Codeforces Round #274(Div2) B. Towers 贪心
- Codeforces Round 428 div2 A-C
- Codeforces Round #312 (Div. 2) C. Amr and Chemistry 暴力
- Codeforces Round 245 div1A&div2C Xor-tree dfs暴搜
- Codeforces Round #307 (Div. 2)-C. GukiZ hates Boxes
- Codeforces Round #253 (Div. 2)A. Anton and Letters
- Codeforces Round #347 (Div. 2) C. International Olympiad 找规律
- Codeforces Round #379 (Div. 2)-D. Anton and Chess
- Codeforces Round #215 (Div. 2) D Sereja ans Anagrams