2013 ACM/ICPC Asia Regional Chengdu Online

4730

各种乱搞,拼手速了。

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 using namespace std;
 5 char str[110];
 6 int main ()
 7 {
 8     int t;
 9     scanf("%d",&t);
10     for(int Case=1; Case<=t; ++Case)
11     {
12         scanf("%s",str);
13         char *pos= strstr(str,"desu");
14         printf("Case #%d: ",Case);
15         if(pos==NULL)
16         {
17             printf("%s",str);
18         }
19         else
20         {
21             for(int i=0;i<=(pos-str-1);++i)
22             {
23                 printf("%c",str[i]);
24             }
25         }
26         printf("nanodesu
");
27     }
28 }
View Code

4734

数位dp,见数位DP专题

J  4737

暴力,话说比赛的时候根本没想到可以暴力啊。

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 #define maxlen 100010
 5 using namespace std;
 6 long long n,m;
 7 long long a[maxlen];
 8 int main ()
 9 {
10     int t;
11     scanf("%d",&t);
12     for(int Case=1; Case<=t; ++Case)
13     {
14         scanf("%I64d%I64d",&n,&m);
15         for(int i=0;i<n;++i)
16             scanf("%I64d",&a[i]);
17         long long ans=0;
18         long long temp;
19         for(int i=0;i<n;++i)
20         {
21             temp=a[i];
22             for(int j=i;j<n;++j)
23             {
24                 temp|=a[j];
25                 if(temp<m)
26                     ans++;
27                 else break;
28             }
29         }
30         printf("Case #%d: %I64d
",Case,ans);
31     }
32 }
View Code
原文地址:https://www.cnblogs.com/shuzy/p/3456710.html