Common Boardmy algo incorrect? Edited by author 01.11.2009 16:45 Pirated is Licensed to Pirated Pirated to Pirated Licensed is Licensed to Licensed Cracked is Pirated to Pirated Licensed to Licensed Cracked is Pirated to Pirated Licensed to Licensed It means that programm became Cracked, if we have Pirated version and then we install Pirated OR if we have Licensed version and then we install Licensed version? Pirated is Licensed to Pirated Pirated to Pirated Licensed is Licensed to Licensed Cracked is Pirated to Pirated Licensed to Licensed Are you sure, that it is enough? What about if we install Cracked version after any of other versions? Edited by author 02.11.2009 15:52To everyone. If you have WA#10 read the problem state carefully. A pirated program can never become licensed again. import java.util.*; import java.io.*; public class p1001 { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<String> nums = new ArrayList<String>(); String line; while (true) { line = br.readLine(); if (line == null) break; StringTokenizer st = new StringTokenizer(line); while (st.hasMoreTokens()) { nums.add(st.nextToken()); } }
for (int i = nums.size() - 1; i >= 0; i--) { int num = Integer.parseInt(nums.get(i)); System.out.printf("%.4f\n", Math.sqrt(num)); } } } you did not account for the max size limit on the input.... tl;dr And only one guy could solve this :D Each sentence in problem statement makes sense, it can't be reduced. There are three author solutions, but two other guys didn't submit them. BTW, I don't think that this problem so difficult, try to solve it. P.S. "Условие задачи" = "Problem statement", "condition" - условие, которое может быть истинным или ложным Edited by author 14.12.2013 18:41 Hey, guys, i've did it! No need to be so smarty, just use long long :) Formula is obvious and it already somewhere in this forum, so you can find it USE LONG LONG! Good tricky problem Edited by author 05.12.2012 05:22 Edited by author 13.12.2013 11:36 Edited by author 13.12.2013 11:36 Does Pj becomes last program learned for clone Ci even if Pj was first learned program for clone Ci ? Can someone tell me what's wrong with this program? #include <stdio.h> int main(void) { int n; scanf("%d", &n); printf("%d\n", n-1); return 0; } i have problems with test №3 Please help try test: 2000 then 1999 of "0" and 1 of "1" Or just test: 3 0 0 0 (the statement says there is at least 1 caught fish, but most solutions print 0) What is wrong with my code ? Am i using a wrong algo ? /*1818.cpp*/ #include<iostream> #include<string> #include<string.h> #define MAXN 2000 #define MAXNCHAR 4 using namespace std; string sum(const string &a,const string &b) { string res=""; unsigned carry=0, nA=a.size(), nB=b.size(); while(nA>0 && nB>0) { res.insert(res.begin(),(a[nA-1]-'0'+b[nB-1]-'0'+carry)%10+'0'); carry=(a[nA-1]-'0'+b[nB-1]-'0'+carry)/10; nA--; nB--; } while(nA>0) { res.insert(res.begin(),(a[nA-1]-'0'+carry)%10+'0'); carry=(a[nA-1]-'0'+carry)/10; nA--; } while(nB>0) { res.insert(res.begin(),(b[nB-1]-'0'+carry)%10+'0'); carry=(b[nB-1]-'0'+carry)/10; nB--; } if(carry>0) res.insert(res.begin(),carry+'0'); return res; } string mult1(const string &a,char b) { string res=""; unsigned i,nA=a.size(), carry=0; if(b=='0') { res="0"; return res; } for(i=0;i<nA;i++) { res.insert(res.begin(),((a[nA-1-i]-'0')*(b-'0')+carry)%10+'0'); carry=((a[nA-1-i]-'0')*(b-'0')+carry)/10; } while(carry>0) { res.insert(res.begin(),carry%10+'0'); carry/=10; } return res; } string mult(const string &a,const string &b) { unsigned i,j,nB=b.size(); string tmp,res="0"; for(i=0;i<nB;i++) { tmp=mult1(a,b[nB-1-i]); for(j=0;j<i;j++) tmp.insert(tmp.end(),'0'); res=sum(res,tmp); } return res; } string x,arr[MAXN]; char l=1; unsigned n; void read() { unsigned i; char nChar[MAXNCHAR+1]; cin>>n; for(i=0;i<n;i++) { cin>>arr[i]; l=l && arr[i]=="0"; } sprintf(nChar,"%u",n); x.assign(nChar); } string solve() { string res; unsigned i; if(l==0) { res=arr[n-1]; for(i=1;i<n;i++) { res=mult(res,x); res=sum(res,arr[n-1-i]); } return res; } res=x; for(i=1;i<n;i++) res=mult(res,x); return res; } void write() { cout<<solve()<<endl; } int main() { read(); write(); return 0; } Edited by author 08.02.2011 01:51 Edited by author 08.02.2011 01:52 Edited by author 10.02.2011 16:32 Is output for that case : 2000 1999 of '0' and one '1' http://pastebin.com/WfrYZTAg ? Edited by author 01.05.2011 21:02 Edited by author 01.05.2011 21:02the output for 3 0 0 0 is 9 or 0 ? I've got WA on #3 and for 3 0 0 1 is 9 too? I haven't solved it yet. It's WA3 too. But I think the correct answer for 3 0 0 0 is 27. and for 3 0 0 1 is 9. Edited by author 05.05.2011 04:30 Edited by author 05.05.2011 04:30 What the output for 2000 1999 of '0' and one '1' Can u give the answer of this test? Hello. May I get log or at least description for this error. The Easy Number is in fact the Automorphic Number. And a number is a Automorphic Number when and only when it is the suffix of another Automorphic Number. So, I download a program to make the Automorphic Number of 2000 dights. And... Edited by author 14.03.2009 22:51 Edited by author 14.03.2009 22:51 Edited by author 14.03.2009 22:51 It is evident. But how to implement this without long arithmetic. My solution uses Java.BigInteger and reccurence: k^2*10^2*L+k*(2*A-1)*10^L+Z*10^L=Z1*10^L1; where A*A-A=Z*10^L and A1=k*10^L+A- new value where A1*A1-A1=Z1*10^L1, L1>=L+1 Who solved it. GIVE ME SOME TEST PLEASE!!!!!!! GIVE ME SOME TEST PLEASE!!!!! I think we are missing something which is quite common in this case. http://ideone.com/XHozKe Can someone throw some ideas, why this fails at test case 7? ___Test 13 Fominykh Isenbaev BBB BBB CCC AAA Ayzenshteyn Oparin Samsonov Ayzenshteyn Chevdar Samsonov Dublennykh Fominykh Ivankov Burmistrov Dublennykh Kurpilyanskiy Cormen Leiserson Rivest Oparin AA AAA Isenbaev Oparin Toropov AA DD PP PP QQ RR RR SS TT TT Toropov Oparin ____correct answer: AA 2 AAA 2 Ayzenshteyn 2 BBB 1 Burmistrov 3 CCC 2 Chevdar 3 Cormen undefined DD 3 Dublennykh 2 Fominykh 1 Isenbaev 0 Ivankov 2 Kurpilyanskiy 3 Leiserson undefined Oparin 1 PP 3 QQ 4 RR 3 Rivest undefined SS 3 Samsonov 2 TT 2 Toropov 1 #include<cstdio> #include<cstring> #include<cassert> #include<vector> #include<list> #include<queue> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include<functional> #include<numeric> #include<utility> #include<sstream> #include<iostream> #include<iomanip> #include<cmath> #include<cstdlib> #include<ctime> #include<fstream> #include<typeinfo> #include<locale> #include<iterator> #include<valarray> #include<complex> using namespace std; int main() { int n,m; while(cin>>n>>m){ int sum = 0,flag = 0,count = -1,x=n*m; n--; if(n==0 || m==0){ cout<<"0"<<endl; continue; } while(sum < x){ if(flag==0){ sum += m; flag = 1; m--; } else if(flag==1){ sum += n; flag = 0; n--; } count++; } cout<<count<<endl; } return 0; } here is my code, it has got verdict WA in test case 10.... Why, if one of the strip, the answer is 2? "Red" and "Red"? If n = 1, then the only strip may be Red or White, so answer is 2. If n = 2, then you can either start with Red or White, but for each, you can only place White or Red respectively for the second strip, so answer is 2 again. The largest known prime number is currently the Mersenne prime 2^{57,885,161} - 1. Discovered January, 2013. Edited by author 12.12.2013 01:30 please give me a test for WA4. According to my current logic result should be (filled bucket weight - empty bucket weight) for each mathematician. Edited by author 11.12.2013 19:12 Try this test: 7 5 9 3 4 8 Answer: 3 2 How can gelu's army reach the castle in 11 days?? what is the limit for output size it could be very big for n=10000 and s=100000 and if the coordinates is in center of hypercube then there is (s-1)*2^(n-1) by bishop and n*(s-1) by rock squares that queen can move how the hell should i output this?? or am i wrong??? plz help ASAP!!! Edited by author 21.08.2008 07:36 Edited by author 21.08.2008 07:36 you can use BigInteger class in java, which calculates the numbers of any sizes... |
|