Codeforces Round #165 (Div. 2)
这次比赛还是比较顺的,题目也不错.
最让我感触的是d题, 如果我告诉你这就是是最长递增子序列,你会不会做?。。。 所以还是太弱太弱了
a.看(180-a)能不能被360整除就行了
b.wa了一次, 题意有点纠结,其实我当时也没怎么看懂题意, 大概知道是消息更新就会跑到最顶端,然后给出一个有原位置的序列,求最多有多少消息一定是新的。
要注意的是一定是更新了的, 所以有些可能更新的就不算了,当只有一个数1时, 不能知道是不是一定是更新了的,所以只要求出后面最长的递增的序列的长度(这些都可能是没有更新的),用总的减之就是答案了。
1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 #include <string> 5 #include <iostream> 6 using namespace std; 7 8 int g[100100]; 9 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 for(int i=1;i<=n;i++) 15 scanf("%d",&g[i]); 16 int tmp=g[n]; 17 int cnt=1; 18 for(int i=n-1;i>=1;i--) 19 { 20 if(g[i]<tmp) 21 { 22 cnt++; 23 tmp=g[i]; 24 } 25 else break; 26 } 27 printf("%d",n-cnt); 28 return 0; 29 30 }
c. 这题我咋感觉如此简单。。。 因为箱子里还可以放箱子,所以每一个箱子都是独立的。 只要求出那一种箱子需要的箱子最大,就是总的需要的最大的哪个箱子.
1 #include <stdio.h> 2 #include <string.h> 3 #include <algorithm> 4 #include <string> 5 #include <iostream> 6 using namespace std; 7 8 9 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 __int64 mx=0; 15 for(int i=0;i<n;i++) 16 { 17 __int64 k,a; 18 scanf("%I64d%I64d",&k,&a); 19 if(a==0) continue; 20 __int64 tmp=1; 21 int cnt=0; 22 do 23 { 24 tmp*=4; 25 cnt++; 26 }while(tmp<a); 27 28 int tmx=k+cnt; 29 if(tmx>mx) mx=tmx; 30 } 31 printf("%I64d",mx); 32 return 0; 33 34 }
d. 想了一下午, 如果要看到ACM_DP中有.

浙公网安备 33010602011771号