- 博客(25)
- 收藏
- 关注
原创 新的博客
lvat2000.is-programmer.com 一晃三年过去了,我从PJ组脱坑到了TG组 时间过的真快呢 博客已经搬迁到了lvat2000.is-programmer.com 欢迎移步 lvat2000.is-programmer.com
2016-08-17 23:10:43
354
原创 WikiOI 1231 最优布线问题
这个问题让无数人崩溃,而且没有标程。我来贡献一个吧。。。。。。(从网上的标准kruskal+并查集代码改的)(我不会并查集) #include #include #include using namespace std; struct self{int x,y;long long c;}; self s[1000001]; int a,b,m,n; long long z=0; int f[10
2013-07-11 23:14:31
1504
2
原创 WikiOI 1063 合并果子
唉。。。。。。数据弱了些,连我这种一遍遍找都能过。 我没用快排,这样会超时。 #include #include int cmp(const void *a,const void *b){return *(int *)a-*(int *)b;} int x1,x2,n,i,ans=0,a[10010]; int soo(){ int j,m1=2000000000,x1=0,x2=0,m2=
2013-06-14 11:43:58
778
1
原创 [SmartOJ2373]驾驶密码
题目在此 继续模拟…… #include #include char x[1000000]; int main(){ int key; scanf("%d",&key); key%=26; while(gets(x)){ if(x[0]==EOF)return 0; int d=strlen(x); for(i
2013-10-05 22:44:04
657
原创 [SmartOJ1295]银行取款
题目在此 使用STL队列,AC. #include #include #include using namespace std; queue q; int main() { char z; int x; while(cin>>z){ if(z=='I'){ scanf("%d",&x); q.push(x); } if(
2013-10-05 22:42:12
634
原创 [SmartOJ1902]恶搞的短信
题目在此 这题其实就是个模拟。比较简单~ #include #include #include #include #include char str[1000005]; struct PX{ int x,y; }xy[1000005]; int num,now=0; int cmp(const void *a,const void *b){ if((*(PX *)a).x==(*(
2013-10-05 22:37:54
706
原创 [HAOI2007]反素数ant
我会说其实反素数很少的么…… #include long long ant[]={1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560, 10080, 15120, 20160, 25200, 27720, 45360, 50400, 55440, 83160, 1
2013-10-05 22:33:32
638
原创 [HAOI2008][CQOI2011]糖果传递
大水题一道。 #include #include #include using namespace std; #include int a[1000001],p[1000001]; long long i,ans,tot,now,n; int main(){ scanf("%d",&n); for (i=0;i<n;i++) scanf("%d",&a[i]),tot+=a[i];
2013-10-05 22:31:42
987
原创 printf
#include int main(){ int i=3; printf("%d %d %d %d %d %d",i++,i++,++i,--i,i--,--i); } 这个代码的结果是啥? 是 2 1 3 3 2 3 奇怪吧。。。 是很奇怪。。。。 为什么? 本人暂时未懂。。。。。
2013-07-07 21:22:02
515
转载 WikiOI 2924 数独挑战
说实话,有了这个程序,我就能通杀那个数独网了。真方便! #include using namespace std; int a[9][9]; int Line[9],Row[9],S[3][3]; bool Flag; void Set(int x,int y,int n) { int t=1<<n; Line[x]|=t; Row[y]|=t; S[x/3][y/3]|=t; } bo
2013-07-07 21:16:25
659
原创 WikiOI 1053 笨小猴
#include long ns[27]={0}; long pzs(long kkk){ long i; if(kkk<=1)return 0; for(i=2;i*i<=kkk;i++){ if(kkk%i==0)return 0; } return 1; } int main(){ char s[110],tmp; long i; for(i
2013-07-07 21:13:09
615
原创 WikiOI 1012 最大公约数和最小公倍数问题
不太想写,直接搜的 #include int main(){ int x0, y0, x, i = 2, k = 0; scanf("%d%d",&x0, &y0); if (y0 % x0 != 0) {printf("0\n"); return 0;} x = y0 / x0; while (x != 1) { while (x % i != 0) i
2013-06-11 22:03:55
805
转载 WikiOI 1160 蛇形矩阵
写起来太麻烦,直接在百度搜的, #include #include int main() { int i=0,j=0,n=0; scanf("%d",&n);//矩阵阶数 int **p=NULL;//二维指针,存放矩阵n*n个元素 p= (int**)malloc(n*sizeof(int*));//先分配n个一维指针 if(NULL==p) exit(1); for (
2013-06-11 22:00:35
1146
原创 WikiOI 1083 Cantor表
不算难。 #include int main(){ int i,n,bn; scanf("%d",&bn); n=bn; for(i=1;n>0;i++) n-=i; n+=i; if(i%2==1)printf("%d/%d",n-1,i+1-n); else printf("%d/%d",i+1-n,n-1); return 0; }
2013-06-11 21:58:43
593
原创 WikiOI 1076 排序
使用快排,懒得写代码了。 #include #include int cmp(const void *a,const void *b){return *(int *)a-*(int *)b;} int main(){ int i,n,a[100001]; scanf("%d",&n); for(i=0;i<n;i++)scanf("%d",&a[i]); qsort(a,
2013-06-11 21:57:24
571
原创 WikiOI 1075 明明的随机数
#include int n,fn,i,tmp,k[1001]={0}; int main(){ scanf("%d\n",&n);fn=n; for(i=0;i<n;i++){ scanf("%d",&tmp); if(k[tmp]==1){fn--;} k[tmp]=1; } printf("%d\n",fn); for(
2013-06-11 21:55:55
1046
转载 WikiOI 1205 单词翻转
直接倒着输出,递归; #include #include using namespace std; void ex(){ string s; if(!(cin>>s))return; ex(); cout<<s<<" ";} int main(){ ex(); return 0;}
2013-06-11 21:51:31
799
原创 WikiOI 1204 寻找子串位置
我用的指针,方便些. #include #include int main(){int i,j; char a[101],b[101],*s; scanf("%s %s\n",a,b); s=strstr(a,b); for(i=0;i<101;i++){if(s==&a[i]){printf("%d\n",i+1);return 0;}} return 0; }
2013-06-11 21:48:04
1068
原创 WikiOI 2235 机票打折
四舍五入到10位!!!!! #include int main(){ int a;float b; scanf("%d %f",&a,&b); float k=a*b/10.0; k=(int)(k+5)/10; k*=10; printf("%.lf\n",k); return 0; }
2013-06-11 21:46:36
1865
原创 WikiOI 1206 保留两位小数
用double,别用float,不然会挂 #include int main(){ double a; scanf("%lf",&a); printf("%.2lf",a); return 0; }
2013-06-11 21:44:43
575
原创 WikiOI 1203 判断浮点数是否相等
float读入,然后判断 #include int main(){ float a,b; scanf("%f %f",&a,&b); if(a==b){printf("yes\n");return 0;} printf("no\n"); return 0; }
2013-06-11 21:43:05
721
原创 WikiOI 1202 求和
一个个读入,一个个加,一道水题 #include int main(){ int tmp,n,set=0; scanf("%d",&n); while(n--){ scanf("%d",&tmp); set+=tmp; } printf("%d\n",set); return 0; }
2013-06-11 21:41:24
658
原创 WikiOI 1201 最小数和最大数
#include #include int main(){ int i,n,tmp,max=-1000000000,min=100000000; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&tmp); if(tmp<min)min=tmp; if(tmp>max)max=tmp; } printf("%
2013-06-11 21:39:55
788
原创 WikiOI 1000 A+B Problem
你懂得。。。。 #include int main(){ int a,b; scanf("%d %d",&a,&b); printf("%d\n",a+b); return 0; }
2013-06-11 09:57:16
547
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅