• 【模拟】Codeforces 711A Bus to Udayland


    题目链接:

      http://codeforces.com/problemset/problem/711/A

    题目大意:

      N个字符串,每个字符串5位,找到第一个出现两个OO的并改成++输出YES和改后字符串,没有输出NO.

    题目思路:

      【模拟】

      签到题。看阅读理解能力和手速。

     1 //
     2 //by coolxxx
     3 //#include<bits/stdc++.h>
     4 #include<iostream>
     5 #include<algorithm>
     6 #include<string>
     7 #include<iomanip>
     8 #include<map>
     9 #include<stack>
    10 #include<queue>
    11 #include<set>
    12 #include<bitset>
    13 #include<memory.h>
    14 #include<time.h>
    15 #include<stdio.h>
    16 #include<stdlib.h>
    17 #include<string.h>
    18 //#include<stdbool.h>
    19 #include<math.h>
    20 #define min(a,b) ((a)<(b)?(a):(b))
    21 #define max(a,b) ((a)>(b)?(a):(b))
    22 #define abs(a) ((a)>0?(a):(-(a)))
    23 #define lowbit(a) (a&(-a))
    24 #define sqr(a) ((a)*(a))
    25 #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
    26 #define mem(a,b) memset(a,b,sizeof(a))
    27 #define eps (1e-8)
    28 #define J 10
    29 #define mod 1000000007
    30 #define MAX 0x7f7f7f7f
    31 #define PI 3.14159265358979323
    32 #define N 1004
    33 using namespace std;
    34 typedef long long LL;
    35 int cas,cass;
    36 int n,m,lll,ans;
    37 char s[N][10];
    38 int main()
    39 {
    40     #ifndef ONLINE_JUDGE
    41 //    freopen("1.txt","r",stdin);
    42 //    freopen("2.txt","w",stdout);
    43     #endif
    44     int i,j,k;
    45     
    46 //    for(scanf("%d",&cass);cass;cass--)
    47 //    for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
    48 //    while(~scanf("%s",s+1))
    49     while(~scanf("%d",&n))
    50     {
    51         for(i=1;i<=n;i++)
    52             scanf("%s",s[i]);
    53         for(i=1;i<=n;i++)
    54         {
    55             if(s[i][0]==s[i][1] && s[i][0]=='O')
    56             {
    57                 s[i][0]=s[i][1]='+';
    58                 break;
    59             }
    60             else if(s[i][3]==s[i][4] && s[i][3]=='O')
    61             {
    62                 s[i][3]=s[i][4]='+';
    63                 break;
    64             }
    65         }
    66         if(i<=n)
    67         {
    68             puts("YES");
    69             for(i=1;i<=n;i++)
    70                 puts(s[i]);
    71         }
    72         else puts("NO");
    73     }
    74     return 0;
    75 }
    76 /*
    77 //
    78 
    79 //
    80 */
    View Code
  • 相关阅读:
    深入源码之JDK Logging
    随机数生成器
    简单日志LogHelper
    Xml、Json序列化
    Redis封装之Set
    Redis封装之Hash
    Redis封装之String
    Redis之创建
    AngularJS初接触
    简单缓存Cache
  • 原文地址:https://www.cnblogs.com/Coolxxx/p/5821994.html
Copyright © 2020-2023  润新知