Why TLE.anyone can help me?
#include<iostream.h>
int main(){
int i,j,k,n,c=0,l,m,s;
while(cin>>n){
if((n==1)||(n==0))
{ cout<<n<<"!"<<endl<<'1';}
else{
int a[100000]={-1};
i=99999;
j=n*(n-1);
while(j>9){
k=j%10;
a =k;
j=j/10;
i--;}
a =j;
for(l=n-2;l>=2;l--){
for(j=99999;j>=i;j ...
Search found 7 matches
- Wed Mar 28, 2007 3:37 pm
- Forum: Volume 6 (600-699)
- Topic: 623 - 500!
- Replies: 187
- Views: 71594
- Tue Mar 20, 2007 6:54 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10110 - Light, more light
- Replies: 76
- Views: 39769
- Tue Mar 20, 2007 6:24 pm
- Forum: Volume 4 (400-499)
- Topic: 408 - Uniform Generator
- Replies: 48
- Views: 9946
- Mon Mar 05, 2007 7:51 pm
- Forum: Volume 3 (300-399)
- Topic: 392 - Polynomial Showdown
- Replies: 93
- Views: 31647
WA of 392
Why WA,please help me.
#include<iostream.h>
int main()
{
int a,count=9,i=0,p=0,c=0;
char y='x';
while(cin>>a){
i++;
if(a>0){
if(p==0){
if(i==9)
cout<<a;
else
{ if(a!=1)
cout<<a;}
p=1;}
else
{ cout<<'+'<<" ";
if(a!=1)
cout<<a;}
}
else if(a<0)
{ cout<<'-'<<" ";
a=-a;
if((a ...
#include<iostream.h>
int main()
{
int a,count=9,i=0,p=0,c=0;
char y='x';
while(cin>>a){
i++;
if(a>0){
if(p==0){
if(i==9)
cout<<a;
else
{ if(a!=1)
cout<<a;}
p=1;}
else
{ cout<<'+'<<" ";
if(a!=1)
cout<<a;}
}
else if(a<0)
{ cout<<'-'<<" ";
a=-a;
if((a ...
- Sat Mar 03, 2007 6:10 am
- Forum: Volume 6 (600-699)
- Topic: 623 - 500!
- Replies: 187
- Views: 71594
RE of 623
Why it shows runtime error,please help me
Here is my code:
#include<iostream.h>
int main(){
int i,j,k,n,c=0,l,m,s;
int a[1200];
while(cin>>n){
if(n>1){
for(i=0;i<1200;i++)
a =-1;
i=1199;
j=n*(n-1);
while(j>9){
k=j%10;
a =k;
j=j/10;
i--;}
a =j;
for(l=n-2;l>=2;l--){
for(j=1199 ...
Here is my code:
#include<iostream.h>
int main(){
int i,j,k,n,c=0,l,m,s;
int a[1200];
while(cin>>n){
if(n>1){
for(i=0;i<1200;i++)
a =-1;
i=1199;
j=n*(n-1);
while(j>9){
k=j%10;
a =k;
j=j/10;
i--;}
a =j;
for(l=n-2;l>=2;l--){
for(j=1199 ...
- Sat Mar 03, 2007 5:35 am
- Forum: Volume 4 (400-499)
- Topic: 408 - Uniform Generator
- Replies: 48
- Views: 9946
OLE of 408
Why output limit exceed,please help me
here is my code:
#include<stdio.h>
int main(){
int step,seed=0,mod,i,k;
while(scanf("%d%d",&step,&mod)==2){
i=0;
seed=0;
k=seed;
seed=(seed+step)%mod;
i++;
while(seed!=k){
seed=(seed+step)%mod;
i++;}
printf("%10d%10d",step,mod);
if(mod==i ...
here is my code:
#include<stdio.h>
int main(){
int step,seed=0,mod,i,k;
while(scanf("%d%d",&step,&mod)==2){
i=0;
seed=0;
k=seed;
seed=(seed+step)%mod;
i++;
while(seed!=k){
seed=(seed+step)%mod;
i++;}
printf("%10d%10d",step,mod);
if(mod==i ...
- Fri Mar 02, 2007 6:04 pm
- Forum: Volume 3 (300-399)
- Topic: 324 - Factorial Frequencies
- Replies: 23
- Views: 7342
WA of 324
I do not able to understand why my program produces wrong answer.
Her is my code:
#include<stdio.h>
#include<iostream.h>
int main(){
int i,j,k,b[10],n,c=0,l,m,s;
int a[800] ;
while(cin>>n){
for(i=0;i<800;i++)
a =-1;
for(i=0;i<10;i++)
b =0;
if(n<=366){
i=799;
j=n*(n-1);
while(j>9){
k=j ...
Her is my code:
#include<stdio.h>
#include<iostream.h>
int main(){
int i,j,k,b[10],n,c=0,l,m,s;
int a[800] ;
while(cin>>n){
for(i=0;i<800;i++)
a =-1;
for(i=0;i<10;i++)
b =0;
if(n<=366){
i=799;
j=n*(n-1);
while(j>9){
k=j ...