ACM
Saar
一名小白
展开
-
poj2299
#include#define lolo long longusing namespace std;const lolo maxn=510000;lolo n,a[maxn],ans,t[maxn];void Sort(lolo l,lolo r){ if(l==r) return; lolo mid=(l+r)/2; Sort(l,mid);转载 2013-01-30 14:40:06 · 404 阅读 · 0 评论 -
poj1363
#include#includeusing namespace std;const int maxn=1000+10;int main(){int n,p[maxn];cin>>n;while(n){int x,max=0;cin>>x;while(x){memset(p,0,sizeof(p));bool valid=true;fo转载 2013-01-28 09:58:17 · 406 阅读 · 0 评论 -
poj1555
#includeusing namespace std;const int n=9;inline int fabs(int k){ return k}int main(){ int a[n]; while(cin>>a[0]) { for(int i=1;i cin>>a[i];转载 2013-01-12 10:44:28 · 398 阅读 · 0 评论 -
poj1504
#include#include#include#includeusing namespace std;int Num[3][1000];void Read(int ord){ int flag=0; string tmp; cin>>tmp; for(int i=tmp.length()-1;i>=0;i--) {原创 2013-01-11 11:13:10 · 358 阅读 · 0 评论 -
poj2080
#includeusing namespace std;const char wstr[][20]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"};int days_of_year(int year){ if(year%100==0) return year%4原创 2013-01-11 10:21:22 · 403 阅读 · 0 评论 -
poj1011
//总是超时。。。先贴下代码吧。。。别人的代码:#include #include bool concatenate(int,int,int,int);//递归函数,判断某个长度是否是木棒可能的原始长度//为qsort准备的比较函数int compare(const void *arg1,const void *arg2){return *(int转载 2013-01-10 13:12:35 · 329 阅读 · 0 评论 -
2013
方法1:#includeusing namespace std;void print(int n){ char s[30]; cin>>s; cout if(--n) { cin>>s; if(--n) print(n); cout }}i原创 2013-01-10 11:57:00 · 342 阅读 · 0 评论 -
poj1979
#include#include#includeusing namespace std;const int maxn=25,maxm=25;int n,m,ans;string map[maxn];bool visited[maxn][maxm];void search(int row,int col){ if(row=n||col=m||map[ro原创 2013-01-10 11:36:29 · 317 阅读 · 0 评论 -
poj2083
#include#includeusing namespace std;char map[731][731];void print(int n,int x,int y){ int m; if(n==1) { map[x][y]='X'; return ; } if(n>1) {原创 2013-01-10 12:33:04 · 652 阅读 · 0 评论 -
windows下安装启动MongoDB
1.下载.2.解压3.cmd-->下设置数据库的位置路径\bin\mongod.exe --dbpath=路径\db4.cmd-->打开另一个cmd开始mongo5.显示如下图,则连接成功:原创 2013-01-09 23:47:07 · 340 阅读 · 0 评论 -
poj2106
#includeconst int maxn=100+10;int val[maxn],vtop;int op[maxn],otop;void insert(int b){ while(otop&&op[otop-1]==3) { b=!b; --otop; } val[vtop++]=转载 2013-01-28 10:21:43 · 695 阅读 · 0 评论 -
poj1060
#includeusing namespace std;const int maxl=1005;int compare(int a[],int la,int b[],int lb){ if(la>lb) return 1; if(la return -1; for(int i=la-1;i>=0;i--)转载 2013-01-12 10:57:38 · 391 阅读 · 0 评论 -
2379
#include#includeusing namespace std;const int maxn=1100;struct judgement{ int c,t,p,r;};struct team{ int id,ac,t; int p[25]; bool sol[25];};bool cmp转载 2013-01-30 14:16:17 · 409 阅读 · 0 评论 -
poj2388
#include#includeusing namespace std;const int maxn=11000;int a[maxn],n;int main(){ cin>>n; for(int i=1;i>a[i]; sort(a+1,a+n+1); cout return 0;}转载 2013-01-30 14:01:29 · 403 阅读 · 0 评论 -
poj2418
#include#include#includeusing namespace std;typedef map record;record h;string s;int n;int main(){ n=0; while(getline(cin,s)) { n++; h[s]++; }转载 2013-01-30 13:57:30 · 446 阅读 · 0 评论 -
poj1012
#includeusing namespace std;int ans[15];int joseph(int k,int m){ int s,i; s=0; for(i=0;i { s=(s+m-1)%(2*k-i); if(s } return 1;}int main(){转载 2013-01-29 11:35:15 · 436 阅读 · 0 评论 -
poj1591
#includeusing namespace std;bool del[51];int card[21];int main(){ int m,n,j,k,cur; int loop=1; while(cin>>n>>m) { memset(del,false,sizeof(del)); cur=n;原创 2013-01-29 10:55:07 · 772 阅读 · 0 评论 -
poj3044
扫描一直WA:#includeusing namespace std;long stack[50002];long x,y;int main(){ int n; long w; int ans=0,top=-1; scanf("%ld %ld",&n,&w); scanf("%ld %ld",&x,&y); sta转载 2013-01-29 13:32:46 · 484 阅读 · 0 评论 -
poj3125
#includeusing namespace std;const int maxn=100+5;inline int fabs(int k){ return k}int main(){ int loop; cin>>loop; while(loop--) { int n,m; cin转载 2013-01-28 10:58:12 · 844 阅读 · 0 评论 -
poj1488
#include#includeconst char p[][5]={"``","''"};int main(){ int k=0; char c; while((c=getchar())!=EOF) { if(c=='"') { printf("%s",p[k]); k原创 2013-01-13 10:14:28 · 549 阅读 · 0 评论 -
poj2260
#include#define MAXN 512int n;int a[MAXN][MAXN],row[MAXN],col[MAXN];int read_case(){ int i,j; scanf("%d",&n); if(n==0) return 0; for(i=0;i for(j=0;j scanf原创 2013-01-13 09:37:00 · 391 阅读 · 0 评论 -
poj2000
#includeusing namespace std;int main(){ int n,ans; cin>>n; while(n) { ans=0; for(int i=0,j=1;i { int k=j; while(k--&&++i原创 2013-01-09 12:29:16 · 725 阅读 · 0 评论 -
uva11000
#includeusing namespace std;int main(){ int n; cin>>n; while(n>-1) { long long a,b; a=1; b=0; for(int i=0;i {原创 2013-01-09 11:38:43 · 783 阅读 · 0 评论 -
poj1316
#include#include#define N 10000unsigned g[N];unsigned sum_of_digits(unsigned n){ if(n return n; else return (n%10)+sum_of_digits(n/10);}void generate_sequence(uns原创 2013-01-09 11:30:23 · 905 阅读 · 0 评论 -
poj1581
#include#includeusing namespace std;string wname;int wsol;int wpt;string name;int sol;int pt;int sub;int timen;int n;int main(){ wsol=0; wpt=0; cin>>n; wh原创 2013-01-08 16:38:59 · 524 阅读 · 0 评论 -
poj2196
#include#includeint calc(int k,int b){ int n=k; int sum=0; while(n!=0) { sum+=n%b; n=n/b; } return sum;}int main(){ for(int i=2992;i原创 2013-01-08 15:36:57 · 643 阅读 · 0 评论 -
Ural1068
#includeint a,sum;int main(){ scanf("%d",&a); if(a>0) sum=(1+a)*a/2; else sum=(1-a)*a/2+1; printf("%d\n",sum); return sum;}原创 2013-01-08 15:28:44 · 321 阅读 · 0 评论 -
poj3299
#include #include #include #include using namespace std; int main(void) { char alpha; double t,d,h; int i; for(;;) { t=d=h=200;转载 2013-01-08 15:21:15 · 305 阅读 · 0 评论 -
poj3094
#include#includechar s[100];int value(char c){ if(c==' ') return 0; else return c-'A'+1;}int main(){ char c; c=getchar(); int n; int sum; while(c!='#')原创 2013-01-08 15:58:37 · 523 阅读 · 0 评论 -
poj1003
#includeusing namespace std;double sum;int main(){ double a; int i; cin>>a; while(a) { sum=0; for(i=1;sum { sum+=1.0/(i+1); if(s原创 2013-01-08 12:42:49 · 389 阅读 · 0 评论 -
poj1005
#include#includefloat x,y;int n;double cal;int year;//float M_PI=3.1415926;int main(){ scanf("%d",&n); for(int i=1;i { scanf("%f%f",&x,&y); cal=(x*原创 2013-01-08 12:07:58 · 334 阅读 · 0 评论 -
poj2739
#include#includeusing namespace std;int prime[1500];int total=0;int main(){ int a; memset(prime,0,1500); prime[0]=2; total=1; for(int i=3;i {原创 2013-01-08 11:48:07 · 306 阅读 · 0 评论 -
poj1552
#include#includeusing namespace std;int main(){ int a[20]; int j,i=0,n,count; cin>>a[0]; while(a[i]!=-1) { i++; for(;;i++) { cin>>a[i];原创 2013-01-08 10:14:49 · 341 阅读 · 0 评论 -
2242
#include#include#includeusing namespace std;double a,b,c,p,s,d,l;int main(){ double x0,y0,x1,y1,x2,y2; while(cin>>x0>>y0>>x1>>y1>>x2>>y2) { a=sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1)); b=sqrt((x1-x2)*(x1-原创 2013-01-08 19:38:23 · 441 阅读 · 0 评论 -
poj3006
#includeint cnt;bool isprime(int temp) { int k,flag=1; if(temp==2) return true; else if(temp==1||temp%2==0) return false; else {原创 2013-01-08 19:00:41 · 318 阅读 · 0 评论 -
poj1281
#include#includeusing namespace std;int main(){ int minp; int maxp; bool print[10000]; int plen; int np; int cnt[10000]; char req; int condition;原创 2013-01-09 14:01:36 · 522 阅读 · 0 评论 -
poj2864
#includeusing namespace std;int att[120];int main(){ int yes; int n,d; cin>>n>>d; while(n||d) { int i,j,k; yes=0; memset(att,1,sizeof(att));原创 2013-01-09 12:52:39 · 472 阅读 · 0 评论 -
poj1207
#includeusing namespace std;int maxn(int a,int b){ if(a>b) return a; else return b;}int min(int a,int b){ if(a else return b;}int main(){ int a,b,i,n,m;原创 2013-01-09 12:40:40 · 324 阅读 · 0 评论 -
poj1922
#include#includeusing namespace std;int main(){ const double distance=4.50; while(true) { int n; scanf("%d",&n); if(n==0) break; double v,t;原创 2013-01-09 11:06:29 · 613 阅读 · 0 评论 -
poj2017
#includeusing namespace std;int main(){ int n,i,x,y,z,ans; while(cin>>n,n>0) { ans=z=0; for(i=0;i { cin>>x>>y; ans+=(y-z)*原创 2013-01-09 11:05:35 · 417 阅读 · 0 评论