自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

个人信息备份站。。

决定整理一下

  • 博客(136)
  • 收藏
  • 关注

原创 zoj 3418

#include #include #include #include #include #define MAXN 300using namespace std;int judge(int n,int m){ int count = 0,tmp1,tmp2; while(n||m) { tmp1=n%2; n/=2; tmp2=m%2;

2011-06-05 16:35:00 654

原创 zoj 2772 python

import sysdef readANum(): a=sys.stdin.readline() a=a.split() return int(a[0])n=readANum()for i in range(n): k=readANum() a=0;b=0;c=0;d=0; a=k/25 k-=a*25

2011-06-04 02:53:00 747

原创 zoj 2191

<br />  校园网到期了。。。。网通访问csdn 无限的400 。。所以这几天就没写blog<br />import sysfor line in sys.stdin: line=line.split() a=int(line[0]) b=int(line[1]) c=int(line[2]) print a-3*b+3*c,3*a-8*b+6*c,6*a-15*b+10*c<br /> 

2011-05-21 12:21:00 622

原创 zoj 1970

<br />import sysfor line in sys.stdin: line=line.split() count = 0 for i in line[1]: if line[0][count]==i: count+=1 if count>=len(line[0]): break if count>=len(line[0]): pri

2011-05-16 10:35:00 671

原创 zoj 1577

<br />超时数次。。终于900ms过了。。。<br />import sysimport mathdef GCD(x,y): if y==0: return x else: return GCD(y,x%y)for line in sys.stdin: line=line.split() count=0 n1=int(line[0]) n2=int(line[1]) if n1==n2:

2011-05-15 02:32:00 616

原创 zoj 1392

<br />import sys for L in sys.stdin: line=L.split() if line[0]=='ENDOFINPUT' and len(line)==1: break if line[0]=='START' and len(line)==1: continue if line[0]=='END' and len(line)==1: continue for i in

2011-05-15 01:06:00 607

原创 zoj 1109

<br />import sysD={}count=0for line in sys.stdin: line=line.split() #print line if len(line)==0: #print line count+=1 continue if count==0: #tmp='line[1]' D[line[1]]=line[0] #

2011-05-15 00:25:00 750

原创 uva 11130 斯诺克

<br />   uva上交题还真是不容易..一直redirect.. 这个是cl童鞋上java的时候问的..本来看着是模拟..其实把球台折叠拓展到无限就可以直接求了..因为全部都是完全弹性碰撞..并且四角也没有球袋...<br /> <br />  #include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>using namespace std;int main(v

2011-05-13 02:05:00 738

原创 zoj 1025 python

<br />  好吧。。才知道zoj的题目ac人数的排名是一页一页算的。。。这么水的题俺竟然木作。。<br />import sysl=sys.stdin.readline()k=l.split()n=int(k[0])for i in range(n): l=sys.stdin.readline() for j in range(len(l)): sys.stdout.write(l[len(l)-j-2])<br />用了分片的代码。<br />im

2011-05-12 01:16:00 600

原创 zoj 1295 python

<br />  好吧。。才知道zoj的题目ac人数的排名是一页一页算的。。。这么水的题俺竟然木作。。<br />import sysl=sys.stdin.readline()k=l.split()n=int(k[0])for i in range(n): l=sys.stdin.readline() for j in range(len(l)): sys.stdout.write(l[len(l)-j-2])<br />用了分片的代码。<br />im

2011-05-12 01:15:00 568

原创 zoj 2829 python

<br />import sysK=[]i=3def readNum(): l=sys.stdin.readline() l.split() return int(l[0])while True: if i%3==0 or i%5==0: K.append(i) i+=1 if len(K)>=100002: breakfor line in sys.stdin.readlines():

2011-05-11 23:37:00 972

原创 zoj 1045 python

<br />import sysi=1L=[]tmp=0while i<500: i+=1 tmp=tmp+1.0/i L.append(tmp)for line in sys.stdin: n = line.split() if((float)(n[0])==0.00): break for i in range(480): if L[i]>(float)(n[0]): print i+1, break print "card(s

2011-05-11 13:59:00 654

原创 zoj 1797 python

<br />这个。。输入输出。。zoj上的只支持sys.stdin有点小麻烦。。<br />import sysdef readNum(): line = sys.stdin.readline() a = line.split() n = int (a[0]) return ndef gcd(x,y): if x<y: tmp=x x=y y=tmp if y==0:

2011-05-11 13:58:00 939

原创 zoj 3198 python代码超时,求指教。。

<br />用python写了一个。。超时,,自己还写了个二分,,还是超时。。估计是输入太慢了还是怎么地?cin 600ms scanf 230ms<br />求指教。。<br />import sysdef readANum(): line = sys.stdin.readline() a = line.split() n = int(a[0]) return ndef BinarySearch(a,target): low = 0 hi

2011-05-11 01:57:00 842

原创 zoj 1099 python代码

<br />import syslen1=0for line in sys.stdin: list1 = line.split() for w in list1: if w == '<br>': print len1 = 0; elif w == '<hr>': if len1 !=0: print print '-'*80 len1 = 0; else: if len1+len(w)>80: print

2011-05-08 01:12:00 649

原创 title : 接下来先不a题了。。把写过的代码用python重写一边先。。

<br />RT

2011-05-06 00:21:00 782 2

原创 zoj 2520

<br />  额。。这个,有点纠结。。刚开始看错题了。。。纠结了半天。。郁闷阿。a了之后打表交了一道。。多次实验范围在前21;<br /> <br /> <br />#include <cstdio>#include <iostream>#include <cstring>#include <cmath>using namespace std;typedef struct label{int x,y;}type;int yinshu(int n){ int sum

2011-05-04 18:35:00 789

原创 zoj 2433

<br />  其实就是找出线段中最短的那一段,,不能在线段的两端找。。<br />#include <cstdio>#include <climits>#include <cstring>#include <iostream>using namespace std;int main(void){ int ncase,n; int a[51000]; while(cin>>ncase) { while(ncase--) { cin>>n;

2011-05-04 11:52:00 726

原创 zoj 2443 水题。。。

某啥说的。。#include #include #include #include #include using namespace std;#define MAXN 105struct type{ char name[MAXN]; int time[MAXN]; int num[MAXN]; //在第几次解决了问题; int status[MAXN];};struct type duiwu[105];int count0;int main(

2011-05-04 00:47:00 500

原创 zoj 3504 水题

<br />水题,,就是输入有点纠结。。。<br />#include <cstdio>#include <algorithm>#include <cstring>#include <cstdlib>#include <iostream>#include <cmath>using namespace std;#define MAXN 6000int judge(char *x,char *y){ int len = strlen(x); int cou

2011-05-03 20:07:00 766

原创 zoj 1973 水题。。。

<br />#include <cstdio>#include <iostream>#include <cstring>#define MAXN 1005using namespace std;int main(void){ int n; double a[MAXN],b[MAXN]; while (cin>>n) { cout<<n<<" "; for(int i=0;i<n;i++) //cin>>a[i]>>b[i]; scanf("

2011-05-01 17:30:00 445

原创 zoj 2727 list the books

<br />   水题。。不会函数重载。。写了三个cmp。。<br />#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;struct type { char name[105]; int year; int price;};int cmp1(struct type a,struct type b){ if(strcmp(a

2011-05-01 15:48:00 573

原创 zoj 1093 dp Monkey and Banana

<br />   原来老早看了..觉得麻烦后来发现是自己想麻烦了..没有我想的那种情况..原来想的可能存在一边相等,另一边比底下放好的小的情况...这样一层一层往上加箱子还可能存在就根楼梯那种情况..还要保存那条边是相等的.那条边是可以上的....今天自己看了下.原来根本就不存在这种情况,,只需要满足上边的箱子两条边都要比下边的箱子小就行了...<br />  由于箱子是无限的..每个箱子可以有六种摆放的方法..可以看作6*n个方向固定的箱子..然后按照最长xx序列的方法做就可以了..<br />#incl

2011-04-28 22:41:00 652

原创 zoj 1095 丑数

<br />  这个题看似容易但是也让我纠结了一下...最后还是借鉴别人的思路解决的问题...弱爆了...<br /> 如果一个数的质因数只有 2 5 3 7 那么它就是一个丑数..给你一个数n,让你找出第n个丑数..这个显然打表,但是刚开始我做的打表竟然也超时了....于是网上看的思路,分别给2 5 3 7 设置一个计数器.然后相乘,每次找出其中的最小值..并且用了那个就把那个+1,直到达到题目要求的最大值; 注意相乘之后要判断一下.以免出现 2*3=6 和3*2=6,造成重复.<br />  然后就是输

2011-04-26 21:52:00 813

原创 zoj 1154

<br />#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int main(void){ int ncase,b,n; char num[100]; cin>>ncase; while(ncase--) { while(scanf("%d",&b)&&b) { scanf("%s",num); n = 0;int sum = 0

2011-04-26 16:05:00 553

原创 zoj 1089

<br />dfs<br />#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int num[14];int n;int count,a[7];void dfs(int i){ if(count==6) { //output(); for(int j=0;j<5;j++) printf("%d ",a[j]);; cout<<a[5]<<e

2011-04-26 15:04:00 460

原创 1090

<br />  1482 过不了...不知道为啥...切道水题..给不在直线上的三个点的坐标..求外接圆的周长... 其实就是考公式呢..<br />#include <stdio.h>#include <string.h>#include <math.h>#include <iostream>#define PI 3.141592653589793using namespace std;int main(void){ double x1,x2,x3,y1,y2,y3;

2011-04-26 01:10:00 459

原创 zoj 2146

<br />   简单广搜...set好用..恩.<br />#include <cstdio>#include <iostream>#include <queue>#include <set>using namespace std;struct paipai{ int num; int step;};queue<struct paipai>q;set<int> used;int a[5],b[5];int T,from,to; void ito

2011-04-21 20:14:00 469

原创 zoj 2229 贪心..

<br />注意最后那个输出即可,,,<br /> <br />/*贪心,骑车问题.. * * * */#include <stdio.h>#include <string.h>#include <iostream>using namespace std;int main(void){ int n,speed;double time; double min; while(cin>>n) { if(!n) break; min = 999

2011-04-13 01:19:00 518

原创 zoj 2540 判断是否为正方形

<br />先排序,再判断即可..<br />#include <stdio.h>#include <algorithm>#include <stdlib.h>#include <math.h>#include<iostream>using namespace std;struct square{ int x; int y;}s[5];int cmp(square a,square b){ if(a.x==b.x) ret

2011-04-12 00:35:00 506

原创 zoj 1720 模拟

<br />简单模拟..没啥 说的..细节多.烦人..<br />#include <stdio.h>#include <iostream>using namespace std;int main(void){ // freopen("in","r",stdin); // freopen("out_my","w",stdout); int a[10]; while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]

2011-04-11 00:12:00 495

原创 zoj 2679 水题

<br />补全一个五位数,使这个数能够除尽它前边给你的数.<br />#include <stdio.h>#include<iostream>using namespace std;int main(void){ int T,x,y,z,n,flag; cin>>T; while(T--) { flag = 0; scanf("%d %d %d %d",&n,&x,&y,&z); int tmp

2011-04-10 21:32:00 511

原创 zoj 2271 Chance to Encounter a Girl

<br />   这是大黄dp分类里边的。。概率dp。。。但是看完之后我决定硬搞。。。。<br />#include <cstdio>#include <cstring>#include <iostream>#define MAXN 102using namespace std;double tmp[MAXN][MAXN];double dp[MAXN][MAXN];double mpy[MAXN][MAXN];int n;void init(){ double

2011-04-08 00:09:00 704

原创 zoj 2545

<br />   说的是随着计算机的发站。处理器的位数也在不断增加。。10年增加一倍。。现在给你了一种判断增长等级的办法,,让你用这种办法来判断这个数。。其实就是如果这个计算机的位数是32位那么找出一个n是n!小于2的32次方。其实可以把所有的都求出来之后交。<br />#include <stdio.h>int main(void){ int k[]={3,5,8,12,20,34,57,98,170,300,536,966,1754,3210,5910,10944,20366,3806

2011-04-07 20:39:00 489

原创 zoj 1204 dfs

  这题是说的给你一组数,让你找出其中一个是另外的N个数之和(N>=2)。然后按照N的大小输出,,如果N相同。。按照字典序输出。。就是这个N相同按照字典序输出相当扯淡。。不按照字典序的很快就写好了。。但是按照字典序的输出就不会了。。本来搜索就学的不顺。。没办法,,当N相同的时候存到一个二维数组里边。。但是呢。。二维数组我又不会很快的给进行排序。。纠结死了。。没办法。。网上搜代码吧。。。最后找到一个代码。。哇!原来这样就好了阿。。重新了一个。。  我发现这个数据不试很全面。。如果里边有0的话,我的代码就过不了

2011-04-07 00:43:00 1039

原创 zoj 1101 额。。

<br />   这个题的意思就是让你从一组数中挑出一个数,这个数满足三个其他的数相加之和。。。如果有多个这样的数,则输出最大的哪一个。。<br />好吧。。刚开始是用dfs做的。。但是无论怎么优化都是超时。。后来网上搜了一下。。发现大家都是用的暴搜。。囧。。没办法自己写一个。。从数组中任意挑出一个数然后让分别间两个数,之后剩余的值用二分在数组中搜。。。<br />   好吧。。很快写完了代码。。这下不tle了。。陷入了wa了深渊。。。只好找别人的代码对拍,,发现也某有问题阿。。。后来才想到加入负数试试。。

2011-04-06 19:03:00 630

原创 zoj 1101 额。。

<br />   这个题的意思就是让你从一组数中挑出一个数,这个数满足三个其他的数相加之和。。。如果有多个这样的数,则输出最大的哪一个。。<br />好吧。。刚开始是用dfs做的。。但是无论怎么优化都是超时。。后来网上搜了一下。。发现大家都是用的暴搜。。囧。。没办法自己写一个。。从数组中任意挑出一个数然后让分别间两个数,之后剩余的值用二分在数组中搜。。。<br />   好吧。。很快写完了代码。。这下不tle了。。陷入了wa了深渊。。。只好找别人的代码对拍,,发现也某有问题阿。。。后来才想到加入负数试试。。

2011-04-06 19:03:00 454

原创 zoj 2061

<br />   这个是大黄dp分类里边的..这是非dp做法..找出一个公式.  (m+n)!*(m-n+1)/(m+1)<br />刚开始没有处理不能排队的情况..wa了几次..用dev写的代码..忘记去掉system了..re了两次<br />明天试试用dp写一个..<br />#include <stdio.h>#include <string.h>#define MAXN 10000#include <stdlib.h>int num[MAXN]={0};int main(voi

2011-04-05 01:52:00 475

原创 zoj 3432 神奇的位运算。。

<br />不得不说。。。这个真的很神奇。。又学会一招。<br />#include <stdio.h>#include <string.h>char str[8];char str1[8];int main(void){ int n; while (scanf("%d",&n)!=EOF) { int nn = n*2-2; getchar(); gets(str); for(int i=0;i<nn;i++) { //getchar(

2011-04-04 17:06:00 420

原创 zoj 11th programing contest

<br />c题。。给出一个人的年龄让你求出这个人有多少岁,水题不解释。。。倒是这个虚岁让我想起了那个笑话。哈哈!!<br />#include <stdio.h>#include <string.h>int main(void){ char shuxiang[][8] = { "Rabbit", "Tiger","Ox","Rat","Pig", "Dog","Rooster","Monkey","Ram","Horse","Snake","Dragon",}; int ncase

2011-04-03 16:19:00 649 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除