标签:force die cst game 模糊 color namespace font 冲突
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> using namespace std; typedef long long LL; LL n,k; int main() { scanf("%I64d%I64d",&n,&k); LL t1=n/2/(k+1),t2=t1*k; printf("%I64d %I64d %I64d\n",t1,t2,n-t1-t2); return 0; }
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<vector> using namespace std; int n,m,l[105],a[105]; int num[105]; vector<int>v; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=m;i++) scanf("%d",&l[i]); for(int i=1;i<m;i++) { int t=l[i+1]; while(t<=l[i])t+=n; if(a[l[i]]&&a[l[i]]!=t-l[i]){printf("-1\n");return 0;} if(!a[l[i]]) { a[l[i]]=t-l[i]; num[a[l[i]]]++; } } for(int i=1;i<=n;i++) if(num[i]>1){printf("-1\n");return 0;} else if(!num[i])v.push_back(i); for(int i=1;i<=n;i++) { if(!a[i])a[i]=v.back(),v.pop_back(); printf("%d ",a[i]); } return 0; }
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> using namespace std; int n,a,b,num[1000005],x[1000005]; bool f[1000005]; int main() { scanf("%d%d",&n,&a); for(int i=1;i<=n;i++) { scanf("%d",&x[i]); if(a!=x[i]&&num[x[i]]<num[a])f[x[i]]=1; num[x[i]]++; if(a!=x[i]&&num[x[i]]<num[a])f[x[i]]=1; } if(!num[a]){printf("%d\n",a+1);return 0;} for(int i=1;i<=n;i++) { if(a!=x[i]&&num[x[i]]<num[a])f[x[i]]=1; if(!f[x[i]]&&x[i]!=a){printf("%d\n",x[i]);return 0;} } printf("-1\n"); return 0; }
Educational Codeforces Round 24
标签:force die cst game 模糊 color namespace font 冲突
原文地址:http://www.cnblogs.com/Zars19/p/7098483.html