码迷,mamicode.com
首页 > 其他好文 > 详细

P1580-yyy loves Easter_Egg I

时间:2019-10-03 10:31:45      阅读:72      评论:0      收藏:0      [点我收藏+]

标签:git   break   char   second   std   turn   mod   iter   writer   

  1 #include <iostream>
  2 #define _for(i,a,b) for(int i = (a);i < b;i ++)
  3 #define _rep(i,a,b) for(int i = (a);i > b;i --)
  4 #define INF 0x3f3f3f3f
  5 #define MOD 1000000007
  6 #define maxn 50003
  7 typedef long long ll;
  8 
  9 using namespace std;
 10 typedef pair<int,int> P;//first 是最短距离,second 是顶点编号
 11 inline ll read()
 12 {
 13     ll ans = 0;
 14     char ch = getchar(), last =  ;
 15     while(!isdigit(ch)) last = ch, ch = getchar();
 16     while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - 0, ch = getchar();
 17     if(last == -) ans = -ans;
 18     return ans;
 19 }
 20 inline void write(ll x)
 21 {
 22     if(x < 0) x = -x, putchar(-);
 23     if(x >= 10) write(x / 10);
 24     putchar(x % 10 + 0);
 25 }
 26 string ater;
 27 int Linenum = 1;
 28 string tmp;
 29 string getWriter()
 30 {
 31     string rnt;
 32     int i = 10;
 33     while(tmp[i]!= )
 34     {
 35         rnt += tmp[i];
 36         i ++;
 37     }
 38     return rnt;
 39 }
 40 bool judgeValid()
 41 {
 42     int i = 10;
 43     int atnum = 0;
 44     while(tmp[i]!=:)
 45         i ++;
 46     i ++;
 47     for(;i < tmp.size();i ++)
 48         if(tmp[i]==@)
 49             atnum ++;
 50     return atnum==1;
 51 }
 52 string getAter()
 53 {
 54     string rnt;
 55     int i = 10;
 56     while(tmp[i]!=:)
 57         i ++;
 58     i ++;
 59     for(;i < tmp.size();i ++)
 60     {
 61         if(tmp[i]==@)
 62         {
 63             i += 11;
 64             for(int j = i;j < tmp.size() && tmp[j] !=   && tmp[j]!=\n&&tmp[j]!=\r;j ++)
 65                 rnt += tmp[j];
 66             return rnt;
 67         }
 68     }
 69     return "";
 70 }
 71 int main()
 72 {
 73     getline(cin,tmp);
 74     ater = getAter();
 75     while(getline(cin,tmp))
 76     {
 77         if(tmp=="" || tmp=="\n" || tmp=="\r")
 78             break;
 79         string w1 = getWriter();
 80         Linenum ++;
 81     //    cout << w1 << endl;
 82         if(w1==ater)
 83         {
 84             printf("Successful @yyy loves %s attempt",ater.c_str());
 85             return 0;
 86         }
 87         if(judgeValid())
 88         {
 89             string tt = getAter();
 90             if(tt!=ater)
 91             {
 92                 string w = getWriter();
 93                 printf("Unsuccessful @yyy loves %s attempt\n%d\nyyy loves %s",ater.c_str(),Linenum,w.c_str());
 94                 return 0;
 95             }
 96         }
 97         else
 98         {
 99             string w = getWriter();
100             printf("Unsuccessful @yyy loves %s attempt\n%d\nyyy loves %s",ater.c_str(),Linenum,w.c_str());
101             return 0;
102         }
103     }
104     printf("Unsuccessful @yyy loves %s attempt\n%d\nGood Queue Shape",ater.c_str(),Linenum);
105     return 0;
106 }

 

P1580-yyy loves Easter_Egg I

标签:git   break   char   second   std   turn   mod   iter   writer   

原文地址:https://www.cnblogs.com/Asurudo/p/11619111.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!