Common BoardHello everybody! I wanted to share with you a little site that I made: http://acmtimusru.appspot.com with two additional ranklists: (1) countries ranklist: to compare countries between them by: rating, users, problems solved and activity = last ac; clicking on each country will get you to (2); (2) authors by country ranklist: to compare yourself with other people from your country. This site looks exactly like the acm.timus.ru site, with all links pointing to acm.timus.ru, except for the top red link that points to the countries ranklist. I hope you'll find this useful. I know this site will get deprecated as soon as the admins will create these ranklists on acm.timus.ru, but I had fun building it and learning something new (google app engine). Hello everybody! I wanted to share with you a little site that I made: http://acmtimusru.appspot.com with two additional ranklists: (1) countries ranklist: to compare countries between them by: rating, users, problems solved and activity = last ac; clicking on each country will get you to (2); (2) authors by country ranklist: to compare yourself with other people from your country. This site looks exactly like the acm.timus.ru site, with all links pointing to acm.timus.ru, except for the top red link that points to the countries ranklist. I hope you'll find this useful. I know this site will get deprecated as soon as the admins will create these ranklists on acm.timus.ru, but I had fun building it and learning something new (google app engine). Thank u so much... Great job, man. Hi! Can you share me your code? Or/And Can you tell me, every when update the lists? Thank you! My solution int main(){ //ios_base::sync_with_stdio(0); int l, r, t; cin >> l >> r >> t; cout << t * (l / r) << ' ' << t * (l/r + !(l % r == 0)) << endl;
return 0; } My solution falls on test 29. I have AC. My calculation of some values was wrong.:( If you have TL you should output line very effective (if you output one character you get TL). For pascal good output: s:string; setlength(s,n); s:='.......'; write(s). #include<iostream.h> #include<string.h> using namespace std; int main() { int number; cin>>number; string s; int i=0; for(;i<number;i++) { cin>>s; std::size_t find=s.find("puton"); std::size_t find1=s.find("one"); if((find != std::string::npos)||(find1 != std::string::npos)) cout<<"YES\n"; else cout<<"NO"; s.clear(); } //system("pause"); return 0; } Obviously you aren't testing all the words. You has to consider if the input string contains a substring that isn't (one/output/out/in/input/puton). I'll just add that test #1 for this problem is a pretty serious test that requires complete correctness, not just the samples to pass (unlike in other problems). Is it possible to buy several subscriptions? It's not forbidden, but it's never necessary for optimal solution. Each subscription for k or more concerts, you not need more then one. Just why? 4 1 1000 5 1000 5 1000 5 1000 5 2 10 You need to buy two identical subscriptions to get 3600. Ignore my post above, I misunderstood the problem statement. But still, even if you understand, i still don't. In case of 4 1 1000 5 1000 5 1000 5 1000 5 2 10 or even, if we're not allowed to use the same subscription twice, 4 2 1000 5 1000 5 1000 5 1000 5 2 10 2 10 , why can't we have 3600? That is, if i understood you correctly... Can you give me a hint about 8 test "If it turns out that the last cut should be made at the coordinate of exactly 1 meter, then, of course, this cut is not made." This code in Java: int v = 0; int n = 1998; while (buffer.length() > 1) { v += n; v %= buffer.length(); buffer.deleteCharAt(v); } Got AC in 0.109 time using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; namespace Пример {
class Programm { static void Main(string[] args) { int num= int.Parse( Console.ReadLine());
int sum = 0; if (num<10000&&num>-10000) { if (num > 0) { for (int i = 1; i <= num; i++) { sum += i; } } else if (num < 0) { for (int i = num; i <= 1; i++) { sum += i; } } }
Console.WriteLine(sum); }
} } using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; namespace Пример {
class Programm { static void Main(string[] args) { int num= Convert.ToInt32( Console.ReadLine());
int sum = 0; if (num > 0) { for (int i = 1; i <= num; i++) { sum += i; } } else if (num < 0) { for (int i =num; i <=1; i++) { sum += i; } }
Console.WriteLine(sum); }
} } There is an undirected graph with n vertices and m edges. There have been three types of requests: to add an edge (X_i, y_i), remove the edge (X_i, y_i), and check whether or not vertices x_i and y_i connected. I read this problem(disjoint set union division) in this site http://e-maxx.ru/algo/sqrt_decomposition (this is in russian but i use google translate) The approach is also given, they use disjoint sets with sqrt decomposition. I didn't understand this . plz help. My algo is right. Now i have AC. My problem is input string. I rewrite my program on Pascal (i use ANSISTRING) and got AC. Edited by author 21.08.2016 18:31 помогите, что в нём?!?! спасибо, за помощь ) так. с 16-м разобрался, но что же на 28 ? #include <iostream> #include <math.h> #include <algorithm> #include <vector> using namespace std; int main() { vector<long long int>v; long long int b; while (cin >> b) v.push_back(b); reverse(v.begin(),v.end()); for (long long int k: v) cout << fixed << sqrt(k) << "\n"; return 0; } The problem's author did not write that, after the last move you need to print out a position, but it follows from the third example and tests Please add this condition My code is ok all tests before #8, but I've WA on #8... Anything that I don't see? Thanks Can anyone help me? I have the same problem and I know the code is ok, I checked it 100 times Edited by author 29.07.2005 01:06 I also had WA on test#8(now I have AC). I don't know this test, but look: N = 362880 Right Q is 2578899. You see: all numbers(digits)in Q must be sorted: 2<=5<=7<=8<=8<=9<=9 - it's condition for minimal Q, but you must surch begining from 9
in my program the digits are sorted. for your example my answer is also 2578899 correct answer for 0 is 10. maybe this fact help you. my God..my alog is WRONG. thx! Edited by author 02.10.2011 20:48 May be this helps. If input is 12 output should be 26 not 34 . It is something strange... My program outputs 10, when input is 0, in your examples: 12 -> 26, not 34, but I have WA#8, why????? Program is correct, maybe tests are wrong??? Yes i am having the exact same problem... considered all test cases and am getting the write answers in ascending order but test#8 is giving WA Edited by author 03.12.2005 18:23 Edited by author 03.12.2005 18:23 I think tests are OK. If you still need some help send me your code to sk1@hotbox.ru try input 1000 000 000 I have this problem too!!! All test, what i see is correct; I use unsigned long; May be it consist false; What I doing wrong? Edited by author 05.04.2006 14:23 How about N = 13 ? ;) test Edited by author 04.07.2006 19:44 my solution in c++ 0.031 s. #include<iostream> #include<cmath> #include<string> #include<algorithm> using namespace std; inline bool isprime(long a) { if(a==1)return false; if(a==2)return true; if(a%2==0)return false; for(int i=3;i<sqrt(a);i+=2) { if(a%i==0)return false; } return true; } int main() { string a; long n; int d=1; cin>>n; if(n==0)cout<<"10"<<endl; else if(n==1)cout<<"1"<<endl; else{ if(isprime(n) && n>10)d=0; else { int gamyop=9; while(n!=1) { if(n%gamyop==0) { a+=(gamyop+'0'); n/=gamyop; if(isprime(n) && n>10){d=0;break;} } else { gamyop--; } } } sort(a.begin(),a.end()); if(d==1)cout<<a<<endl; else cout<<"-1"<<endl; } return 0; } I have this problem too!!! All test, what i see is correct; I use unsigned long; May be it consist false; What I doing wrong? Edited by author 05.04.2006 14:23 try string,or int64 try string,or int64 if I using __int64 I have overflow too. In this problem must use only string for result. I used recursive algorithm. (C++) result and local variables in function must be __int64(long long) In other cases you'll get an overflow Usage of string not are obligatory Test#8 is: N=1 000 000 000 Q->555555555888 for examle with local or result variables of type unsigned you'll get Q->1504774704 Sorry for my English :) I don't know if what is exactlly the test but the answer is something like -1 or 26 ;D It works for me there after fixing that... ;) Yep... problem in java was using int instead of long. Yep... problem in java was using int instead of long. I have Q->555555555888 when N=1 000 000 000, but Test#8 say "WA". Why? thanks mate. I was getting wrong for this reason. Those who are getting WA at Test #8. try to use "Unsigned long long int" insted of "int". No subject Edited by author 13.12.2017 23:34 This problem involves number theory??? > This problem involves number theory??? yes, you can refer to chapter 33 of Introduction to Algorithms, MIT Press, there covers enough knowledge you need to solve the problem. suppose d is multiplicative inverse of e, modulo (p - 1)(q - 1), where p * q = n then the answer should be c^d (mod n) > > This problem involves number theory??? > > yes, you can refer to chapter 33 of Introduction to Algorithms, > MIT Press, there covers enough knowledge you need to solve the > problem. > > suppose d is multiplicative inverse of e, modulo (p - 1)(q - 1), > where p * q = n > > then the answer should be c^d (mod n) Но ведь ответ не всегда верен! Контрпример: e=3 n=15 (p=3,q=5) c=3 GCD(e,(p-1)(q-1))=GCD(3,8)=1 e<(p-1)(q-1) e*d=1 modulo (2*4) => d=3 m=c^d (modulo n)=3^3 mod (15)=(15+12) modulo (15)=12 (modulo 15) != 3 modulo (15)=c modulo (15) Проблема возникает в случае GCD(c,n)>1 (p or q (if pq then c=0 mod (n))). Автор забыл упомянуть, что GCD(c,n)=1 или мне повезло с АС? Edited by author 17.08.2016 14:41 #include <iostream> using namespace std; int main() { int k; cin >> k; int n; cin >> n; int change; int result = 0; for (int i = 0; i < n; i++) { cin >> change; result += change; } if (result - k*n >= 0) cout << result - k*n; else cout << 0; return 0; } Author's behavior. 1) You should explain what problem is - WA/TLE/runtime error. 2) You should better remove/clear/add explanation to post after you solved task yourself. Edited by author 16.08.2016 21:18 |
|