BYRBT
摘要: A:扫一遍。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int n; 8 9 char s1[3],s2[3];10 11 int main()12 {13 scanf("%d",&n);14 int ans=1;15 scanf("%s",s1);16 for (int a=2;a 2 #include 3 #include 4 5 using namespace std; 6 7 int main() 8 { 9 int a,b,c;10 scanf(... 阅读全文
posted @ 2013-09-16 10:38 zhonghaoxi 阅读(211) 评论(0) 推荐(0) 编辑
摘要: A:不会做……B:看不懂题……C:二分答案顺序检验。 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int maxn=100010; 9 10 int n,m;11 12 long long z[maxn],y[maxn];13 14 bool check(long long v)15 {16 int p=1;17 for (int a=1;a>1));24 while (pm;36 }37 38 int main()39 {40 ... 阅读全文
posted @ 2013-09-16 10:20 zhonghaoxi 阅读(371) 评论(0) 推荐(0) 编辑
摘要: Lollipop:如果X可行,那么X-2也一定可行。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 const int maxn=1000010; 8 const int INF=0x3f3f3f3f; 9 10 int n,m,z[maxn],ans[maxn=1;a--)37 {38 sum+=z[a];39 if (sum&1)40 {41 right=a;42 rv=sum;43 ... 阅读全文
posted @ 2013-09-11 08:43 zhonghaoxi 阅读(549) 评论(0) 推荐(0) 编辑
摘要: A:只可能有1 2 4、1 2 6、1 3 6三种情况,先把4分光然后就乱搞了。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int n,cnt[10]; 8 9 int main()10 {11 scanf("%d",&n);12 for (int a=1;acnt[2])24 {25 printf("-1\n");26 return 0;27 }28 while (cnt[6])29 {30 if (cnt[3... 阅读全文
posted @ 2013-09-10 15:31 zhonghaoxi 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 题意去八中看,很清晰。Festival:嘛,首先可以很轻松的建出差分约束的模型,然后强连通缩点之后发现不同块的点是没有联系的,于是可以每块分开做。每块的答案就是点与点之间距离的最大值,提前floyd处理即可。 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int maxn=610; 9 const int maxm=200010; 10 const int INF=0x3f3f3f3f; 11 12 int n,m1,m2,t,en,size,cnt,z[ma... 阅读全文
posted @ 2013-09-02 15:32 zhonghaoxi 阅读(1384) 评论(0) 推荐(1) 编辑
摘要: 250pt:最大xor和路径。由于权值比较小,暴力就行了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 #include 16 17 using namespace std; 18 19 int n; 20 21 struct rec 22 { 23 int num,v; 24 ... 阅读全文
posted @ 2013-09-01 13:53 zhonghaoxi 阅读(1340) 评论(0) 推荐(1) 编辑
摘要: A:题意不知道,似乎是排序。 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int maxn=60; 9 10 int n,m,z[maxn];11 12 int main()13 {14 scanf("%d%d",&n,&m);15 for (int a=1;a 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 int a,b,c,d; 9 10 int gcd(int a 阅读全文
posted @ 2013-09-01 10:03 zhonghaoxi 阅读(389) 评论(0) 推荐(0) 编辑
摘要: D:定义表G(i,j)=gcd(i,j),给出一段序列,问该序列是否在n*m的G表上的某一行出现过。首先考虑行,设x为该序列所有数的最小公倍数,那么首先x肯定是可以满足该表的需求的,而更大的x的倍数只可能导致数列中的值变大,所以我们只需要检验行为x是否存在答案即可。然后考虑列,设序列中的数位z1、z2……,如果我们最后求出来的列为j,那么我们有:gcd(x,j)=z1gcd(x,j+1)=z2……由这些式子可以得出:j mod z1=0j+1 mod z2=0……于是变成多个同余方程的问题,中国剩余定理解出最小的j,如果此时不满足那么更大的j也肯定不满足。因为下一个满足的j为j+x,但是j+x 阅读全文
posted @ 2013-09-01 09:51 zhonghaoxi 阅读(394) 评论(0) 推荐(0) 编辑
摘要: 这是一场5道题都写不到1K的CF。A:题意是排序。 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 int n,z[100]; 9 10 char s[100];11 12 int main()13 {14 scanf("%s",s+1);15 int l=strlen(s+1);16 s[l+1]='+';17 int p=1;18 while (s[p]>='0' && s[p] 2 #include 3 #includ 阅读全文
posted @ 2013-09-01 09:31 zhonghaoxi 阅读(282) 评论(1) 推荐(1) 编辑
摘要: A:询问[l,r]之间有多少个能被x整除的数。这是简要的题意,分类居然是math。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int gcd(int a,int b) 8 { 9 if (!b) return a;10 else return gcd(b,a%b);11 }12 13 int main()14 {15 int x,y,a,b;16 scanf("%d%d%d%d",&x,&y,&a,&b);17 x=x/gcd(x,y)*y;18 printf( 阅读全文
posted @ 2013-08-31 22:29 zhonghaoxi 阅读(307) 评论(0) 推荐(0) 编辑
BYRBT