摘要: 地址:http://codeforces.com/contest/253/problem/A一开始没意识到文件输入输出学会了freopen函数,长知识了,这样直接用stdin和stdout,很方便这题很简单,输出相邻两位性别不同的个数最多的一种情况 1 #include<stdio.h> 2 3 int m,n; 4 5 int main() 6 { 7 freopen("input.txt","r",stdin); 8 freopen("output.txt","w",stdout); 9 scanf 阅读全文
posted @ 2013-01-17 23:23 tjsuhst 阅读(219) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/255/problem/A三种运动,循环锻炼,看哪一种锻炼的最多 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int n,e[3]; 5 char a[3][9]={"chest\0","biceps\0","back\0"}; 6 7 int main() 8 { 9 int i,in,max=0,ans=0;10 scanf("%d",&n);11 for(i=0;i& 阅读全文
posted @ 2013-01-17 14:54 tjsuhst 阅读(173) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/259/problem/A判断输入棋盘是否能变成标准形式只要一列中有相邻两格颜色一样就判断为NO,否则每行可通过移位来变成标准棋盘(储存棋盘的数组都可以不用)#include<stdio.h>#include<stdlib.h>char a[8][9];int main(){ int i,j,flag=0; for(i=0;i<8;i++) { scanf("%s",a[i]); for(j=0;j<7;j++) { if(a[i][j]==a[i... 阅读全文
posted @ 2013-01-17 14:19 tjsuhst 阅读(196) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/263/problem/A要求输出将1换到5x5矩阵中心的步数一个个读入,碰到1时,用(2,2)加减一下坐标即可C99标准中abs()函数在stdlib.h中,而非math.h 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main() 5 { 6 int i,j,in,ans; 7 for(i=0;i<5;i++) 8 { 9 for(j=0;j<5;j++)10 {11 scanf("%d",... 阅读全文
posted @ 2013-01-17 14:02 tjsuhst 阅读(185) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/260/problem/A首先是没注意到多答案,其次我先用了一个位一个位枚举的办法,结果可想而知后来明白只需加一位,后面添0即可 1 #include <stdio.h> 2 3 int a,b,n; 4 5 int main() 6 { 7 int i,flag=0; 8 scanf("%d %d %d",&a,&b,&n); 9 for(i=0;i<10;i++)10 {11 if((a*10+i)%b==0) {a=a*10+i;flag=1;break;}12 阅读全文
posted @ 2013-01-17 01:46 tjsuhst 阅读(166) 评论(0) 推荐(0)
摘要: 地址:http://codeforces.com/contest/262/problem/A最开始没考虑到不多于k包括0的情况,所以对第一组样例奇怪了一会题很简单,一个一个来判断,通过取余来判断,通过除法来移位 1 #include <stdio.h> 2 int n,k; 3 int main() 4 { 5 int i=0,con=0,num=0,ans=0; 6 scanf("%d %d",&n,&k); 7 for(i=0;i<n;i++) 8 { 9 con=0;10 scanf("%d",&num); 阅读全文
posted @ 2013-01-17 01:02 tjsuhst 阅读(153) 评论(0) 推荐(0)
摘要: 地址:http://hustoj.sinaapp.com/problem.php?id=1819方法:枚举断点,注意全是w的情况 1 #include <stdio.h> 2 3 int nl[701];//necklace 4 int n;//珠子个数 5 6 int main() 7 { 8 int f1,f2,l1,l2,i=0; 9 int ca=0,cb=0,ans=0;10 char in[701];11 scanf("%d",&n);12 scanf("%s",in);13 for(i=0;i<n;i++)14 { 阅读全文
posted @ 2013-01-17 00:25 tjsuhst 阅读(333) 评论(0) 推荐(0)