[Codeforces Round #145 (Div. 2, ACM-ICPC Rules)]A. Lefthanders and Righthanders

地址:http://codeforces.com/contest/234/problem/A

排座位,左右撇子都有,要求每两个人坐一起手不打架

 1 #include<stdio.h>
 2 
 3 int n;
 4 
 5 int main()
 6 {
 7     int l,r;
 8     char in[101];
 9     freopen("input.txt","r",stdin);
10     freopen("output.txt","w",stdout);
11     scanf("%d",&n);
12     scanf("%s",in);
13     l=1;
14     r=n/2+1;
15     while(l<n/2+1 && r<n+1)
16     {
17         if(in[l-1]=='R' && in[r-1]=='L') printf("%d %d\n",r++,l++);
18         else if(in[l-1]=='L' && in[r-1]=='R') printf("%d %d\n",l++,r++);
19         else printf("%d %d\n",l++,r++);
20     }
21     
22     return 0;
23 }

 

posted @ 2013-01-21 22:41  tjsuhst  阅读(242)  评论(0)    收藏  举报