Here's my code:
C:
#include<stdio.h>
#include<string.h>
char sieve[19999580];
long count=0,twin[100005],i,j;
void main(){
memset(sieve,1,sizeof(sieve));
for(i=4,j=6;i<=19999558||j<=19999558;i+=2,j+=3) sieve[j]=sieve =0;
for(i=5;i<=19999558;i+=2){
if(sieve &&sieve[i-2]) twin[count++]=i-2;
for ...
Search found 19 matches
- Sun Jul 02, 2006 1:38 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10394 - Twin Primes
- Replies: 101
- Views: 48486
- Sun Jul 02, 2006 1:27 pm
- Forum: Volume 1 (100-199)
- Topic: 195 - Anagram
- Replies: 242
- Views: 58092
195 - Anagrams Why WA?
I don't understand why WA.
Here's my code:
#include<stdio.h>
#include<string.h>
int count,n,len;
char num[200],string[300],s[300];
void permute(){
int i;
/*Uppercase letters*/
for(i=65;i<91;i++){
if(num ){
string[count++]=i;
num --;
if(count==len) printf("%s\n",string);
else permute ...
Here's my code:
#include<stdio.h>
#include<string.h>
int count,n,len;
char num[200],string[300],s[300];
void permute(){
int i;
/*Uppercase letters*/
for(i=65;i<91;i++){
if(num ){
string[count++]=i;
num --;
if(count==len) printf("%s\n",string);
else permute ...
- Sun Oct 19, 2003 12:51 pm
- Forum: Volume 4 (400-499)
- Topic: 402 - M*A*S*H
- Replies: 56
- Views: 21464
Why is 402 - M*A*S*H Runtime error (SISEGV)?
[cpp]
#include<stdio.h>
#include<malloc.h>
struct person{
int n;
struct person*next;
}*head,*tail,*cur;
void build(int p){
head=tail=cur=0;
for(int i=0;i<p;i++){
cur=(struct person*)malloc(sizeof(struct person));
cur->n=i+1;
if(!head) head=cur;
else tail->next=cur;
tail=cur;
tail->next ...
#include<stdio.h>
#include<malloc.h>
struct person{
int n;
struct person*next;
}*head,*tail,*cur;
void build(int p){
head=tail=cur=0;
for(int i=0;i<p;i++){
cur=(struct person*)malloc(sizeof(struct person));
cur->n=i+1;
if(!head) head=cur;
else tail->next=cur;
tail=cur;
tail->next ...
- Wed Sep 17, 2003 7:12 am
- Forum: Volume 104 (10400-10499)
- Topic: 10484 - Divisibility of Factors
- Replies: 39
- Views: 26211
10484 - Never mind it
Could anybody help me??
I got WA all the time.
Here's my code:
[c]
????????????????
[/c]
Never mind!!

I got WA all the time.
Here's my code:
[c]
????????????????
[/c]
Never mind!!


- Sun Aug 31, 2003 4:18 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10252 - Common Permutation
- Replies: 150
- Views: 73237
- Sun Aug 31, 2003 4:11 pm
- Forum: Volume 8 (800-899)
- Topic: 845 - Gas Station Numbers
- Replies: 12
- Views: 9417
845 - Gas Station Number WA?????
Can anyone help? This problem's driving me nuts!!!
Anyone can give some sample I/O???
Thanx in advance!!


Anyone can give some sample I/O???
Thanx in advance!!
- Sat Jun 28, 2003 6:06 am
- Forum: Volume 101 (10100-10199)
- Topic: 10197 - Learning Portuguese
- Replies: 45
- Views: 22791
10197
#include<stdio.h>
#include<string.h>
int l,c;
char v1[50],v2[50],t;
void main(){
while(scanf("%s",&v1)!=EOF){
gets(v2);
printf("%s (to%s)\n",v1,v2);
l=strlen(v1)-1;
if(v1[l]=='r'){
if(v1[l-1]=='a'||v1[l-1]=='e'||v1[l-1]=='i') {
t=v1[l-1];v1[l-1]=0;
if(t=='i') c=1;
}
}
if(!v1[l-1 ...
#include<string.h>
int l,c;
char v1[50],v2[50],t;
void main(){
while(scanf("%s",&v1)!=EOF){
gets(v2);
printf("%s (to%s)\n",v1,v2);
l=strlen(v1)-1;
if(v1[l]=='r'){
if(v1[l-1]=='a'||v1[l-1]=='e'||v1[l-1]=='i') {
t=v1[l-1];v1[l-1]=0;
if(t=='i') c=1;
}
}
if(!v1[l-1 ...
- Thu Jun 26, 2003 5:59 pm
- Forum: Volume 5 (500-599)
- Topic: 573 - The Snail
- Replies: 45
- Views: 27874
- Wed Jun 04, 2003 4:49 pm
- Forum: Volume 5 (500-599)
- Topic: 573 - The Snail
- Replies: 45
- Views: 27874
573 The Snail Why WA ?
Anybody can tell me where my mistake is? This problem REALLY REALLY drives my crazy !!!!!!!!!!!
Here's my code
[c]#include<stdio.h>
int i;
int s,h,u,f,d;
void main(){
while(1){
scanf("%i %i %i %i",&h,&u,&d,&f);
if(h==0){break;}
h*=100;u*=100;d*=100;
for(i=1,s=0,f*=(u/100);;i++){
s+=u;
if(s ...
Here's my code
[c]#include<stdio.h>
int i;
int s,h,u,f,d;
void main(){
while(1){
scanf("%i %i %i %i",&h,&u,&d,&f);
if(h==0){break;}
h*=100;u*=100;d*=100;
for(i=1,s=0,f*=(u/100);;i++){
s+=u;
if(s ...
- Mon Apr 07, 2003 8:03 am
- Forum: Volume 101 (10100-10199)
- Topic: 10195 - The Knights Of The Round Table
- Replies: 59
- Views: 22719
- Mon Apr 07, 2003 7:52 am
- Forum: Volume 102 (10200-10299)
- Topic: 10279 - Mine Sweeper
- Replies: 102
- Views: 43117
- Sun Apr 06, 2003 8:08 am
- Forum: Volume 102 (10200-10299)
- Topic: 10279 - Mine Sweeper
- Replies: 102
- Views: 43117
- Wed Apr 02, 2003 4:39 pm
- Forum: Volume 102 (10200-10299)
- Topic: 10279 - Mine Sweeper
- Replies: 102
- Views: 43117
- Wed Apr 02, 2003 4:32 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10195 - The Knights Of The Round Table
- Replies: 59
- Views: 22719
- Tue Apr 01, 2003 8:41 am
- Forum: Volume 102 (10200-10299)
- Topic: 10279 - Mine Sweeper
- Replies: 102
- Views: 43117
10279 Why WA and WA ???
consider this input :
4
. . . *
. * * .
. . . .
* * * *
xxx.
xx..
x...
x...
What will the output be?
Output 1
. . . *
. * * .
. . . .
* * * *
Output 2
123.
1**.
3...
****
Or neither of them?, if so what will it be?
4
. . . *
. * * .
. . . .
* * * *
xxx.
xx..
x...
x...
What will the output be?
Output 1
. . . *
. * * .
. . . .
* * * *
Output 2
123.
1**.
3...
****
Or neither of them?, if so what will it be?