Problem E All in All

Input: standard inputOutput: standard output

Time Limit: 2 secondsMemory Limit: 32 MB

解题思路:深夜debug,将Yes写成YES,将No写成NO!!竟然贡献了那么的WA,明明就是刚学C的人都能A的题目嘛。。。。

 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #define SIZE 1100000
 5 using namespace std;
 6 char sub[SIZE], base[SIZE];
 7 int main()
 8 {
 9     #ifndef ONLINE_JUDGE
10     freopen("input.txt", "r", stdin);
11     #endif
12 
13     while(scanf("%s%s", sub, base) != EOF)
14     {
15         int len = strlen(sub);
16         int base_len = strlen(base);
17         int j = 0;
18         if(len > base_len) 
19         {
20             printf("No\n");
21             continue;
22         }
23         for(int i=0; i<base_len; ++i)
24         {
25             if(sub[j] == base[i]) j++;
26             if(j>=len) break;
27         }
28         if(j >= len) printf("Yes\n");
29         else printf("No\n");
30     }
31     
32     return 0;
33 }

 

相关文章:

  • 2021-10-17
  • 2021-12-03
  • 2022-12-23
  • 2021-07-28
  • 2021-08-23
  • 2022-12-23
  • 2021-11-25
  • 2021-08-12
猜你喜欢
  • 2021-12-13
  • 2022-02-28
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案