Your scanner gives element not found exception by scanner because it cannot find any integer in input file. All number this large will be treated as string input by scanner
Well, i certainly canāt find any test cases. First thing, keep your code clean, it will help degugging. Second thing, you havenāt added last digit to sum after testing for impossible cases.
Maybe you can ask problem setters for this⦠They can provide much better test cases then i can.
by doing these it again show RE(NZEC)
and i doesnāt understand
Your scanner gives element not found exception by scanner because it cannot find any integer in input file. All number this large will be treated as string input by scanner
can u tell me the solution for 102 and 100
Hey @taran_1407, did you solve the third problem i.e. Optimal Subset?
I have a conventional O(n^2) DP approach and optimizing it seems way too difficult to me and I canāt even think of any other way to approach that problem too.
Any suggestions on that?
I got only 40 points in Optimal Subset using an observation. Just waiting for official editorial to find out whether its correct or not.
thanks mate, but loop will traverse at max six time because it is traversing digits. So how can it be TLE⦠I just canāt understand.
How come loop will transverse 6 times only??
Loop will transverse like 10^6 times as i know,
maximum value of n is 100000 so it remain in the int range so it is not the reason of getting RE(NZEC) . So why i am getting RE(NZEC).please help!
thank you.
Loving your explanations dude.
well done C.A as your institute suggests
@taran_1407
I am getting run-time error. I tried too much to find where i am getting this but failed.
please help me.
this is my codeā>
https://www.codechef.com/viewsolution/15994545
thank you
Probably weak test casesā¦
N is the number of digits in given problemā¦
Means the number can be upto 10^(10^5), way beyond int and long range
Mate
Try following tesr case
1
10000200000000000
Can anyone give me a test case where my code fails? Itās working well for all the test cases I checked.
PLEASE HELP ME!!!
Iām storing the digits in an array from oneās place. Then I am iterating through all the digits and finding the new number by removing that particular digit. Now, Iām checking whether it is divisible by 6 or not and if it is then I check whether it is largest number possible which I initially set to -1. At last Iām printing the new number with k-1 digits where k is the total number of digits in the initial number. Leading zeros will be printed since I used %0*d and passed k-1 and maxnum to it. LINK:-My Solution
Thanksā¦
PS: I am a first year student, not yet CA. Long way to go!!
Mate, You cannot take a number with 10^5 digits in int data type. You have to input it as a string.
Try following test case.
1
10000200000000000
Second thing, Your solution try to delete one digit, check the resultant number. This way, Your solution has time complexity O(N^2), which wonāt even pass the time limit for number of digits upto 10^3.