Search found 6 matches

by Tahasin
Thu Sep 03, 2009 11:49 am
Forum: Volume 109 (10900-10999)
Topic: 10902 - Pick-up Sticks
Replies: 24
Views: 13168

why wa

#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<algorithm> using namespace std; bool crosspoint(double x1,double y1,double x2,double y2,double xm,double ym,double xn,double yn); double max(double a, double b) { return a>b ? a : b; } double min(double ...
by Tahasin
Thu Oct 30, 2008 5:04 pm
Forum: Volume 104 (10400-10499)
Topic: 10474 - Where is the Marble?
Replies: 50
Views: 19097

10474 WA

I can't understand what's wrong with my program. I used quick sort and binary search. Please someone help me....please here is my program #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> using namespace std; void quick(int *A,int p,int r); int partition(int *A,...
by Tahasin
Thu Aug 17, 2006 2:09 pm
Forum: Volume 102 (10200-10299)
Topic: 10235 - Simply Emirp
Replies: 150
Views: 30802

10235 WA

#include<stdio.h> #include<math.h> int prime(int k) { int t,i,p=1; t=sqrt(k); for(i=2;i<=t;i++)if(k%i==0)p=0; if(p)return k;else return 0; } main() { int a,b,c,d; while((scanf("%d",&a))==1) { d=0; b=a; do { c=a%10; d=d*10+c; a/=10; }while(a!=0); if(b==d && prime(b)==b)printf("%d is prime.\n",b); els...
by Tahasin
Thu Aug 17, 2006 2:09 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 60523

10200 WA

#include<stdio.h> #include<math.h> main() { int a,b,c,k[10000],i,j,t,prime,count=0,m,n,counter;float s,p,q; for(i=0;i<=10000;i++) { prime=1; a=i*i+i+41;b=sqrt(a); for(j=2;j<=b;j++)if(a%j==0)prime=0; if(prime){k[count]=i;count++;printf("%d,",i);} } printf("\n\n%d",count); /*while((scanf("%d%d",&m,&n)...
by Tahasin
Thu Aug 17, 2006 2:08 pm
Forum: Volume 6 (600-699)
Topic: 686 - Goldbach's Conjecture (II)
Replies: 41
Views: 18575

686 WA

#include<stdio.h> #include<math.h> #define p 10000 main() { int a,c[p],i,j,prime,count,counter; while((scanf("%d",&a))==1) { if(a==0)break; count=0;counter=0; for(i=2;i<=a;i++) { prime=1; for(j=2;j<=sqrt(i);j++)if(i%j==0)prime=0; if(prime){c[count]=i;count++;} } for(i=0;i<count;i++) { for(j=i;j<coun...
by Tahasin
Thu Aug 17, 2006 1:54 pm
Forum: Volume 104 (10400-10499)
Topic: 10424 - Love Calculator
Replies: 137
Views: 38605

10424

#include<iostream> using namespace std; #include<stdio.h> #include<string.h> int sum2(int p) { int q,s=0; do { q=p%10;s+=q;p/=10; }while(p!=0); return s; }; int sum1(char a[100]) { int i,m,l,n=0; for(i=0;a !='\0';i++) { m=a -'a'+1; if(m>0)l=m; else l=m+32; if(l>=1 && l<=26)n+=l; } return n; }; main(...

Go to advanced search