|
|
back to boardthe best way to SUCCESS, it's not Solution but 99% to test Sol Posted by Erko 13 Nov 2008 15:56 NEXT CODE IS NOT AC SOLUTION but it a way to test your Solution next class run with command: "java tester >test.txt" then you can run your solution and compare your answers with this tester's But you cant test some tests where n>30000, therefore try to think and about it. Good luck to TEST, I AC)) ////////////////////////tester.java/////////////////////////// import java.io.*; import java.util.*; public class tester{ public static void main(String[] args){ int s=0,ts=0; int t; int a[]=new int[30000]; for(int i=0;i<30000;i++){ a[i]=0; } for(int i=1;i<=50000;i++){ ts=s; t=i; while(t>=10){ if(t%10==1){ s++; } t/=10; } if(t==1){ s++;
} if(ts!=s) a[s-1]=i; }
for(int i=0;i<30000;i++){ if(a[i]!=0) System.out.println((i+1) + " "+ a[i]); else System.out.println((i+1)+ " " +"Petr lies"); } } } ////////////////////////end/////////////////////////// |
|
|