I change my code to do gets only once,but it's still the same...WA
Sorry...
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int first[100000],last[100000],array[100000];
char str[10000000];
int main(){
char *p;
int i,j,l,counter,special,n;
gets(str);
p=strtok(str," ");
n=0 ...
Search found 9 matches
- Tue Dec 27, 2005 11:31 am
- Forum: Volume 4 (400-499)
- Topic: 484 - The Department of Redundancy Department
- Replies: 103
- Views: 20424
- Tue Dec 27, 2005 7:20 am
- Forum: Volume 4 (400-499)
- Topic: 484 - The Department of Redundancy Department
- Replies: 103
- Views: 20424
484 Unknow reason WA
hum...I think there are no errors over there,But I just get WA = ="
#include <stdio.h>
#include <string.h>
#include <ctype.h>
long long int first[100000],last[100000],array[100000];
char str[100000];
int main(){
char *p;
long long int i,j,l,counter,special,n;
while(gets(str)){
p=strtok(str ...
#include <stdio.h>
#include <string.h>
#include <ctype.h>
long long int first[100000],last[100000],array[100000];
char str[100000];
int main(){
char *p;
long long int i,j,l,counter,special,n;
while(gets(str)){
p=strtok(str ...
- Mon Dec 05, 2005 6:55 pm
- Forum: Volume 105 (10500-10599)
- Topic: 10591 - Happy Number
- Replies: 61
- Views: 31154
10591 TLE
#include <stdio.h>
int main(){
int get,ans,i,j,check,counter;
scanf("%d",&counter);
for (j = 0;j < counter;j++){
check = 0;
scanf("%d",&get);
printf("Case #%d: ",j+1);
ans = 0;
i= get;
while (check != 1 && check != get){
ans = ans + (i%10) * (i%10) ;
i = i / 10;
if (i == 0){
check ...
- Sun Dec 04, 2005 3:22 am
- Forum: Volume 4 (400-499)
- Topic: 482 - Permutation Arrays
- Replies: 159
- Views: 53689
482 TLE
Sorry...I know it's wierd to get TLE in this problem...
But I just did it ...|||
My code are as follow
#include <stdio.h>
int main(){
int counter,run[1000],i,test,j,k,l;
char number[1000][1000];
scanf("%d",&counter);
for (i = 0;i<counter;i++){
j = 0;
while (scanf("%d",&run[j])){
test ...
But I just did it ...|||
My code are as follow
#include <stdio.h>
int main(){
int counter,run[1000],i,test,j,k,l;
char number[1000][1000];
scanf("%d",&counter);
for (i = 0;i<counter;i++){
j = 0;
while (scanf("%d",&run[j])){
test ...
- Tue Nov 22, 2005 6:23 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10062 - Tell me the frequencies!
- Replies: 235
- Views: 69800
10062 WA...Need help
#include <stdio.h>
#include <string.h>
int main(){
char word[1001];
int number[1001];
int i,max,j;
while (scanf("%s",&word)==1){
max = strlen(word);
for (i = 0; i < 257;i++)
number[i] =0;
for (i = 0; i < max;i++)
number[word[i]] = number[word[i]] + 1;
for (j = 1; j <=max ; j ++){
for ...
- Sat Oct 22, 2005 2:31 am
- Forum: Volume 100 (10000-10099)
- Topic: 10035 - Primary Arithmetic
- Replies: 328
- Views: 102081
10035 Unknow WA
#include <stdio.h>
int main() {
int a,b,a0,b0,counter=0;
while (scanf("%d%d",&a,&b)==2){
counter = 0;
while (a>=10 && b>=10){
a0=a%10;
b0=b%10;
if (a0+b0>=10)
counter = counter + 1;
a=a/10;
b=b/10;
}
if (a<10){
if (a+b%10>=10)
counter = counter + 1;
}
else if (b<10){
if (a%10+b ...
- Sat Oct 22, 2005 2:29 am
- Forum: Volume 100 (10000-10099)
- Topic: 10038 - Jolly Jumpers
- Replies: 445
- Views: 152972
10038 WA,Need assist
#include <stdio.h>
int main(){
int line[3000],number,i,ans,last,counter=1;
while (scanf("%d",&number)==1){
for (i=0;i<number;i++)
scanf("%d",&line[i]);
for (i=0;i<number-1;i++){
if (line[i]>line[i+1]){
ans = line[i] - line[i+1];
counter = counter + 1;
}
if (line[i]<line[i+1]){
ans ...
- Sat Oct 15, 2005 4:50 am
- Forum: Volume 4 (400-499)
- Topic: 494 - Kindergarten Counting Game
- Replies: 119
- Views: 37323
494 WA...
It's ok with sample input...however it can't work when I submit :(
---
#include <stdio.h>
int main() {
int space=0;
char a;
while (scanf("%c",&a)==1){
if (a==' '){
scanf("%c",&a);
if (a!='.')
space = space + 1;
}
if (a=='\n'){
printf ("%d\n",space+1);
space = 0;
}
}
return 0;
}
---
#include <stdio.h>
int main() {
int space=0;
char a;
while (scanf("%c",&a)==1){
if (a==' '){
scanf("%c",&a);
if (a!='.')
space = space + 1;
}
if (a=='\n'){
printf ("%d\n",space+1);
space = 0;
}
}
return 0;
}
- Sat Oct 15, 2005 4:47 am
- Forum: Volume 2 (200-299)
- Topic: 294 - Divisors
- Replies: 91
- Views: 39407
294 TLE,dunno why
#include <stdio.h>
int main(){
int i=0,a,b,ba,b0,c,d,e=0,e0=0;
int j;
scanf("%d",&a);
for (i=1;i<=a;i++){
scanf("%d%d",&b,&c);
b0=b;
for (j=b;j<=c;j++){
e=0;
for (d=j;d>=1;d--){
if (j%d==0)
e=e+1;
if (e0<e){
e0=e;
ba=j;
}
}
}
printf("Between %d and %d, %d has a maximum of %d ...
int main(){
int i=0,a,b,ba,b0,c,d,e=0,e0=0;
int j;
scanf("%d",&a);
for (i=1;i<=a;i++){
scanf("%d%d",&b,&c);
b0=b;
for (j=b;j<=c;j++){
e=0;
for (d=j;d>=1;d--){
if (j%d==0)
e=e+1;
if (e0<e){
e0=e;
ba=j;
}
}
}
printf("Between %d and %d, %d has a maximum of %d ...