The 12th Zhejiang Provincial Collegiate Programming Contest
2015-04-25 19:08
344 查看
水题6题。。。。不想多说了,B题也是爆炸爆炸,最后还是没想出来。
A:水
D:
G:
H:
J: 暴力有点长,就不发了。。 水啊
L:呵呵哒~~
A:水
#include "string" #include "iostream" #include "cstdio" #include "cmath" #include "set" #include "queue" #include "vector" #include "cctype" #include "sstream" #include "cstdlib" #include "cstring" #include "stack" #include "ctime" #include "algorithm" #define pa pair<int,int> #define Pi M_PI #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef long long LL; const int M=30005; int main() { int t; cin>>t; int a[1005]; int b[1005]; while(t--) { int n; cin>>n; memset(b,0,sizeof(b)); for(int i=1;i<=n;++i) { cin>>a[i]; b[a[i]]++; } int m=0; int cnt=0; int ans=0; for(int i=1;i<=1000;++i) { if(b[i]>m) { m=b[i]; cnt=1; ans=i; } else if(b[i]==m) { cnt++; } } if(cnt>1) cout<<"Nobody"<<endl; else cout<<ans<<endl; } }
D:
#include "string" #include "iostream" #include "cstdio" #include "cmath" #include "set" #include "queue" #include "vector" #include "cctype" #include "sstream" #include "cstdlib" #include "cstring" #include "stack" #include "ctime" #include "algorithm" #define pa pair<int,int> #define Pi M_PI #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef long long LL; const int M=30005; int vis[1000005]; int pre[1000005]; int main() { LL ans,x; int n,i,l,T; scanf("%d",&T); while (T--) { scanf("%d",&n); ans=0; memset(vis,-1,sizeof(vis)); memset(pre,-1,sizeof(pre)); for (i=1; i<=n; i++) { scanf("%lld",&x); if (vis[x]==-1) l=i; else l=(i-pre[x]); vis[x]=1; pre[x]=i; ans=ans+x*l*(n-i+1); } printf("%lld\n",ans); } return 0; }
G:
#include "string" #include "iostream" #include "cstdio" #include "cmath" #include "set" #include "queue" #include "vector" #include "cctype" #include "sstream" #include "cstdlib" #include "cstring" #include "stack" #include "ctime" #include "algorithm" #define pa pair<int,int> #define Pi M_PI #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef long long LL; const int M=30005; struct node { string nm; int num; }s[150],m[150],d[150]; int cmp(node a,node b) { return a.num<b.num; } int main() { int t; cin>>t; while(t--) { int a,b,c; cin>>a>>b>>c; int i,j,k; for(i=0;i<a;++i) { cin>>s[i].nm>>s[i].num; } for(i=0;i<b;++i) { cin>>m[i].nm>>m[i].num; } for(i=0;i<c;++i) { cin>>d[i].nm>>d[i].num; } sort(s,s+a,cmp); sort(m,m+b,cmp); sort(d,d+c,cmp); int sum=0; sum=s[a/2].num+m[b/2].num+d[c/2].num; cout<<sum<<" "<<s[a/2].nm<<" "<<m[b/2].nm<<" "<<d[c/2].nm<<endl; } }
H:
#include "string" #include "iostream" #include "cstdio" #include "cmath" #include "set" #include "queue" #include "vector" #include "cctype" #include "sstream" #include "cstdlib" #include "cstring" #include "stack" #include "ctime" #include "algorithm" #define pa pair<int,int> #define Pi M_PI #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3fLL using namespace std; typedef long long LL; const int M=30005; int judge(int x) { if((x%4==0 && x%100!=0) || x%400==0 ) return 1; else return 0; } int main() { int t; cin>>t; while(t--) { int n; cin>>n; int s; s=365*(n-1)+(int)(n-1)/4-(int)(n-1)/100+(int)(n-1)/400; if(judge(n)) { s+=29; } else { s+=28; } s+=31+31+30+1; int m; m=s%7; int sum=5; if(m==1) sum+=2; if(m==0) sum+=1; if(m+5==6) sum+=2; if(m+5==7) sum+=1; cout<<sum<<endl; } }
J: 暴力有点长,就不发了。。 水啊
L:呵呵哒~~
相关文章推荐
- The 12th Zhejiang Provincial Collegiate Programming Contest - D
- The 12th Zhejiang Provincial Collegiate Programming Contest -- 第七场选拔赛
- Convert QWERTY to Dvorak【The 12th Zhejiang Provincial Collegiate Programming Contest 】
- ZOJ 3878 Convert QWERTY to Dvorak (The 12th Zhejiang Provincial Collegiate Programming Contest)
- zjuoj The 12th Zhejiang Provincial Collegiate Programming Contest Ace of Aces
- May Day Holiday【The 12th Zhejiang Provincial Collegiate Programming Contest】
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(第三部分)
- The 12th Zhejiang Provincial Collegiate Programming Contest - I Earthstone Keeper浙江省赛
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Demacia of the Ancients
- The 12th Zhejiang Provincial Collegiate Programming Contest
- ZOJ 3872 Beauty of Array (The 12th Zhejiang Provincial Collegiate Programming Contest )
- 140 - The 12th Zhejiang Provincial Collegiate Programming Contest(2015浙江省赛)
- Ace of Aces【The 12th Zhejiang Provincial Collegiate Programming Contest】
- ZOJ 3875 Lunch Time (The 12th Zhejiang Provincial Collegiate Programming Contest )
- zoj The 12th Zhejiang Provincial Collegiate Programming Contest Capture the Flag
- The 12th Zhejiang Provincial Collegiate Programming Contest - A
- ZOJ 3869 Ace of Aces (The 12th Zhejiang Provincial Collegiate Programming Contest)
- The 12th Zhejiang Provincial Collegiate Programming Contest - G
- ZOJ 3870 Team Formation (The 12th Zhejiang Provincial Collegiate Programming Contest 数位DP+二分)
- The 12th Zhejiang Provincial Collegiate Programming Contest - H