Show all threads Hide all threads Show all messages Hide all messages |
Page 1 |
what is wrong in my algo??? | hhh | 1493. One Step from Happiness | 31 Dec 2008 14:30 | 1 |
#include <iostream> using namespace std; int main() {int n,s1=0,s2=0,i,m,l; cin>>n; m=n;l=n; for(i=0;i<3;i++) {s1+=m%10; m=m/10;} while(m!=0) {s2+=m%10; m=m/10;} if(s1>s2){ if(n%10!=9) cout<<"Yes"; else cout<<"No";} else {if(l%10!=0) cout<<"Yes"; else cout<<"No";} return 0;} |
WA with test 13!!!!heeeelpp=))) | Zaven Musailov | 1493. One Step from Happiness | 24 Nov 2008 17:47 | 1 |
Can anybody tell me this test please?)) |
1493 | Devi@nt | 1493. One Step from Happiness | 2 Jul 2008 04:50 | 1 |
1493 Devi@nt 2 Jul 2008 04:50 Hello y'all! I don't understand what's wrong with my code.When i tested it on my own it worked perfectly).but when i've sent it, it got WA#3.Can u tell me what's wrong,PLEASE).Here's my code in C++: int sum(long a) { return a/100+(a%100)/10+a%10; } bool islucky(long t) { long t1=t/1000,t2=t%1000,a1=sum(t1),a2=sum(t2); if(a1==a2) return true; else return false; } int main() { long t; cin>>t; long t1,t2; t1=t+1; t2=t-1; if(islucky(t1)||islucky(t2)) { cout<<"Yes"<<endl<<t1<<endl<<t2; } else cout<<"No"; return 0; } |
got ac | Anupam Ghosh,Bengal Engg and Sc Uni,MtechIT,2006-09,India | 1493. One Step from Happiness | 10 May 2008 14:07 | 2 |
got ac Anupam Ghosh,Bengal Engg and Sc Uni,MtechIT,2006-09,India 10 May 2008 12:06 use strings to represent numbers Edited by author 10.05.2008 14:08 Re: got ac Anupam Ghosh,Bengal Engg and Sc Uni,MtechIT,2006-09,India 10 May 2008 14:07 well i like problems only if i can solve them |
how do this problem in c++? | Ashot | 1493. One Step from Happiness | 1 May 2008 12:55 | 1 |
how do this problem in c++? Edited by author 01.05.2008 12:55 Edited by author 01.05.2008 12:55 |
what is wrong? | Ashot | 1493. One Step from Happiness | 1 May 2008 13:24 | 2 |
please say what is wrong #include <iostream.h> main() { int n,a,b,c,d,e,f; cin>>n; f=n%10; e=(n/10)%10; d=(n/100)%10; c=(n/1000)%10; b=(n/10000)%10; a=(n/100000)%10; cout<<a<<endl; cout<<b<<endl; cout<<c<<endl; cout<<d<<endl; cout<<e<<endl; cout<<f<<endl; if((a+b+c)-(d+f+e)==1 || ((a+b+c)-(d+f+e)==-1)) cout<<"yes"; else cout<<"no"; return 0; } Edited by author 01.05.2008 12:57 try test 123160 and 889789 You don't need to output a,b,c..., only print Yes or No. Edited by author 01.05.2008 13:28 |
CompError!!! | enick | 1493. One Step from Happiness | 1 Apr 2008 23:04 | 1 |
#include <stdio.h> //#include <iostream.h> #include <stdlib.h> int I,J,i; char a[7]; int main() { int N;
scanf("%d",&N); I=J=0; itoa(N+1,a,10); for (i=0;i<3;i++) { I+=(int)(a[i]-'0'); J+=(int)(a[5-i]-'0'); } if (I==J) {printf("Yes\n"); return 0; } else I=J=0; itoa(N-1,a,10); for (i=0;i<3;i++) { I+=(int)(a[i]-'0'); J+=(int)(a[5-i]-'0'); } if (I==J) { printf("Yes\n"); } else printf("No\n"); return 0; } |
Who can tell me 6_test!!!! | TUIT_MAD | 1493. One Step from Happiness | 22 Mar 2008 07:25 | 1 |
|
I didnt understand the statement | frost | 1493. One Step from Happiness | 4 Mar 2008 19:18 | 1 |
Plz, could anyone explain me, what i have to do... Even looking on the sample tests, i didnt get the task =( |
what is wrong ? | dibrov.bor[SumySU] | 1493. One Step from Happiness | 14 Dec 2007 15:51 | 2 |
I have try to solve this problem in different ways in Java and on C++ but I still have WA1 there are impossible cases 999999 000000 so I don't check overflow or negative I can't imagine what is problem, can somebody tell me what is wrong there ? // edit [code was deleted] oh so silly mistake thank you ! Edited by author 14.12.2007 19:46 he-he) Yes instead YES & No instead NO |
Sample... | Sazuki | 1493. One Step from Happiness | 16 Jan 2008 19:35 | 3 |
445219 4+4+5=13 2+1+9=12 Why No? next ticket is 45220 and 4 + 5 + 2 is not equal to 2 + 2 + 0 you must to check next and previous tickets read the statement carefully Edited by author 02.12.2007 18:11 ты не учёл ещё одну цифру |
Help Me Why I got WA?C++ here is my code | Jerry | 1493. One Step from Happiness | 18 Aug 2007 08:48 | 2 |
ACed Want my prog? cpp_student@163.com HAHAAAAAA Edited by author 18.08.2007 08:41 Edited by author 18.08.2007 08:41 I am a kind person Do you want AC code?????? |
Как решить эту задачу в Turbo Pascal | Emil | 1493. One Step from Happiness | 21 Jul 2011 21:08 | 5 |
Напишите пожалуйста решение Подожди сейчас от имени KAKTUS_OK напишу var a:string; q,w,e,r:longint; cod:integer; begin readln(a); val(a,q,cod); w:=q mod 1000; r:=q div 10000; if (w-r=1) or (r-w=1)then writeln('Yes') else writeln(No); readln end. у меня в паскале всё идёт но на тимусе пролетает your program wouldn't work :) see this without of course without function it can be written but to understand it's better... var n:longint; function name(n:longint):boolean; var n1,n2,s1,s2,i:integer; begin n1:=n div 1000; n2:=n mod 1000; s1:=0; s2:=0; for i:=1 to 3 do begin s1:=s1+n1 mod 10; s2:=s2+n2 mod 10; n1:=n1 div 10; n2:=n2 div 10; end; if s1=s2 then name:=true else name:=false; end; begin readln (n); if ((name(n+1)) or (name(n-1))) and (n<>999999)then writeln ('Yes') else writeln ('No'); end. |
Chinese people plz help me. | Ryan | 1493. One Step from Happiness | 20 Aug 2007 07:05 | 5 |
What is the problem meaning? My english is bad. I can't catch it! Some Chinese friends plz help me send the problem interpretation to this E-mail address: yezhiqi55@126.com OR yezhiqi55@gmail.com Thank you! Edited by author 20.04.2007 11:28 7+1+5<>0+6+8!!! Why did the answer said it is true??? "the previous or the next ticket is lucky"? i.e. ( (715067 is LUCKY) or (715069 is LUCKY)) A ticket is considered lucky if the sum of its first three digits equals the sum of its last three digits. Edited by author 29.04.2007 10:55 7+1+5<>0+6+8!!! Why did the answer said it is true??? 7+1+5<>0+6+8 <=>7+1+1+6+8 <=>23 <=>TRUE For you are a chinese I will give you my algo cpp_student@163.com |
why i have compilitation error? | Husan | 1493. One Step from Happiness | 22 Dec 2011 18:27 | 3 |
#include<iostream.h> #include<math.h> #include<stdlib.h> bool prov(char s[10]) { int k1=0,k2=0; k1=s[0]-'0'+s[1]-'0'+s[2]-'0'; k2=s[3]-'0'+s[4]-'0'+s[5]-'0'; if(abs(k2-k1)==1)return true;else return false; } int main() { char s[10],str1[10]; int pr=0,k1,k2; cin>>s; if(prov(s)==true) { ltoa(atol(s)+1,str1,10); k1=str1[0]-'0'+str1[1]-'0'+str1[2]-'0'; k2=str1[3]-'0'+str1[4]-'0'+str1[5]-'0'; if(k1==k2)pr=1; ltoa(atol(s)-1,str1,10); k1=str1[0]-'0'+str1[1]-'0'+str1[2]-'0'; k2=str1[3]-'0'+str1[4]-'0'+str1[5]-'0'; if(k1==k2)pr=1; if(pr==0)cout<<"No";else cout<<"Yes"; }else cout<<"No"; return 0; } Bu naqani maslahat bermayman Edited by author 25.02.2007 11:27 Edited by author 25.02.2007 11:27 445219 kichkina shaxzoda 22 Dec 2011 18:27 445219 da nimaga No 4+4+5<=>2+1+9 yani 13 va 12 |
WA with test 6 | Aytbaev Madiyar TKTL | 1493. One Step from Happiness | 16 Feb 2007 20:07 | 6 |
Madicon Just Try number 999999 out put will be 'Yes' (000000) and read with string... Edited by author 22.10.2006 12:28 Edited by author 22.10.2006 12:30 But I test it and I have Yes. How come for 999999 output will be "Yes"? It is already a lucky number. Here in what a problem, check it: r = (a[1]+a[2]+a[3])-(a[4]+a[5]+a[6]); if (r=1 && a[6]!=9) cout<<"Yes"; if (r=-1 && a[6]!=0) cout<<"Yes"; else cout<<"No"; |
WA with test 3 | Aytbaev Madiyar TKTL | 1493. One Step from Happiness | 14 Aug 2009 03:49 | 3 |
Test_1:009124 Test_2:009010 Edited by author 05.01.2007 17:51 Edited by author 05.01.2007 17:51 so what the test 3? i have problem with it |
No subject | Aytbaev Madiyar TKTL | 1493. One Step from Happiness | 19 Oct 2006 21:46 | 1 |
Edited by author 09.12.2006 12:22 Edited by author 09.12.2006 12:22 |
WA#3 | IBSU Tbilisi | 1493. One Step from Happiness | 17 Oct 2006 16:33 | 3 |
WA#3 IBSU Tbilisi 14 Oct 2006 15:15 Re: WA#3 Nechaev Ilya (Rybinsk SAAT) 15 Oct 2006 01:44 You will have WA 3 if you using scanf("%i", &n); //read integer number instead scanf("%d", &n); //read decimal integer number If you using "%i", then 012200 will be octal number =) yes but I am using cin and cout |
what's wrong with in.hasNext() in java | javau | 1493. One Step from Happiness | 14 Oct 2006 14:45 | 1 |
I even can not pass the first case! |