浙江省赛
来源:互联网 发布:电气自动化设计软件 编辑:程序博客网 时间:2024/04/29 00:13
A
#include<stdio.h>#include<cmath>#include<cstring>using namespace std;int a[1005];int main(){ int n,t,i; scanf("%d",&t); while(t--) { scanf("%d",&n); memset(a,0,sizeof(a)); int c=-1,ans=0; for(i=1;i<=n;++i) { int x; scanf("%d",&x); a[x]++; if(a[x]>c) {c=a[x];ans=x;} } int T=0; for(i=1;i<=1000;++i) if(a[i]==c) ++T; if(T>1) puts("Nobody"); else printf("%d\n",ans); } return 0;}
B
#include<stdio.h>#include<cmath>#include<cstring>#include<algorithm>using namespace std;typedef long long LL;int a[100005],m[33];int main(){ int t,i,n; scanf("%d",&t); while(t--) { scanf("%d",&n); memset(m,0,sizeof(m)); for(i=1;i<=n;++i) { scanf("%d",&a[i]); int l=1<<30,t=30; while(l) { if(l&a[i]) {m[t]++;break;} l>>=1; t--; } } LL ans=0; for(i=1;i<=n;++i) { int l=1<<30,t=30; while(l) {if(l&a[i])break;l>>=1;--t;} while(l) { if(!(l&a[i])) ans+=m[t]; l>>=1; --t; } } printf("%lld\n",ans); } return 0;}
D
#include<stdio.h>#include<cmath>#include<cstring>#include<algorithm>using namespace std;typedef long long LL;LL p[1000005],a[100005],pos[100005];int main(){ int t,i,n; scanf("%d",&t); while(t--) { scanf("%d",&n); memset(p,0,sizeof(p)); for(i=1;i<=n;++i) { scanf("%d",&a[i]); if(p[a[i]]==0) pos[i]=0; else pos[i]=p[a[i]]; p[a[i]]=i; } LL ans=0; for(i=1;i<=n;++i) ans+=(LL)((i-pos[i])*(n-i+1)*a[i]); printf("%lld\n",ans); } return 0;}
G
#include<stdio.h>#include<cmath>#include<cstring>#include<algorithm>using namespace std;char a[3][55];struct P{ char name[55]; int price;}s[105],m[105],d[105];bool cmp(P a,P b) {return a.price<b.price;}int main(){ int n,t,i,S,M,D; scanf("%d",&t); while(t--) { scanf("%d%d%d",&S,&M,&D); for(i=1;i<=S;++i) scanf("%s%d",s[i].name,&s[i].price); for(i=1;i<=M;++i) scanf("%s%d",m[i].name,&m[i].price); for(i=1;i<=D;++i) scanf("%s%d",d[i].name,&d[i].price); sort(s+1,s+1+S,cmp); sort(m+1,m+1+M,cmp); sort(d+1,d+1+D,cmp); int ans=0; if(S&1) { ans+=s[(S+1)>>1].price; strcpy(a[0],s[(S+1)>>1].name); } else { if(s[S>>1].price>=s[(S>>1)+1].price) { strcpy(a[0],s[S>>1].name);ans+=s[S>>1].price;} else {ans+=s[(S>>1)+1].price; strcpy(a[0],s[(S>>1)+1].name);} } if(M&1) { ans+=m[(M+1)>>1].price; strcpy(a[1],m[(M+1)>>1].name); } else { if(m[M>>1].price>=m[(M>>1)+1].price) { strcpy(a[1],m[M>>1].name);ans+=m[M>>1].price;} else {ans+=m[(M>>1)+1].price; strcpy(a[1],m[(M>>1)+1].name);} } if(D&1) { ans+=d[(D+1)>>1].price; strcpy(a[2],d[(D+1)>>1].name); } else { //printf("%d %d\n",D>>1,(D>>1)+1); //printf("%d %d\n",d[D>>1].price,d[(D>>1)+1].price); if(d[D>>1].price>=d[(D>>1)+1].price) { strcpy(a[2],d[D>>1].name);ans+=d[D>>1].price;} else {ans+=d[(D>>1)+1].price; strcpy(a[2],d[(D>>1)+1].name);} } printf("%d %s %s %s\n",ans,a[0],a[1],a[2]); } return 0;}
H
#include<stdio.h>#include<cmath>#include<cstring>#include<algorithm>using namespace std;int cal(int y,int m,int d){ if (m == 1 || m == 2) m += 12, y--; int c = y / 100; y %= 100; int w = (c >> 2) - (c << 1) + y + (y >> 2) + 13 * (m + 1) / 5 + d - 1; return (w%7+7)%7;}int main(){ int x,t,ans,f; scanf("%d",&t); while(t--) { scanf("%d",&x); f=cal(x,5,1); if(f==1) ans=9; else if(f==3||f==4||f==5||f==6) ans=5; else if(f==2||f==0) ans=6; printf("%d\n",ans); } return 0;}
J
#include<stdio.h>#include<cmath>#include<cstring>#include<algorithm>using namespace std;char a[]="~!@#$%^&*()_+`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?";char b[]="~!@#$%^&*(){}`1234567890[]',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz\"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ";char s[100005];int main(){ int i,j; while(gets(s)) { int l=strlen(s); for(i=0;i<l;++i) { if(s[i]==' ') printf(" "); else { for(j=0;j<strlen(a);++j) if(a[j]==s[i]) break; printf("%c",b[j]); } } puts(""); } return 0;}
L
0 0
- 浙江省赛
- 浙江省赛problem 1003
- 浙江省赛problem 1009
- 2014浙江省赛总结
- 组队_浙江省赛
- 2014浙江省赛总结
- 2015年浙江省赛
- 2015浙江省赛
- 2017 浙江省赛
- 浙江省省赛K题
- 浙江省省赛J题
- 9th 浙江省赛总结
- 第十一届浙江省赛题目
- 浙江省赛 G.Lunch Time
- 2015年浙江省赛总结
- ZOJ3603 2012浙江省赛D
- 2016.4.23 浙江省赛题解
- 浙江省赛zoj3946 Highway Project
- IOS-Foundation-内存管理
- 一些碰到的ora错误
- zxing实现二维码生成和解析
- 第三题
- java引用传递
- 浙江省赛
- uva 10635 Prince and Princess(DP)
- MFC选择目录对话框和选择文件对话框
- 快速掌握一个语言最常用的50%
- leetcode Remove Linked List Elements
- 不同数据库的分页技术
- 最大公约数,最小公倍数
- 重载、this、static的阐述
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(2015浙江省赛)