| Show all threads Hide all threads Show all messages Hide all messages |
| Why k >= max digit in an initial number? | sleepwalker | 1104. Don’t Ask Woman about Her Age | 13 Apr 2017 19:30 | 3 |
Why min base number of the sample is 11? In statement I can't find that k should be >= max digit in an initial number. BTW if I convert any number to binary it will always be divisible by 1 and as far as I see will satisfy every condition from the statement (the given number, written in k-based system is divisible by k−1, 2 ≤ k ≤ 36). Thanks. Edited by author 13.04.2017 17:00 What "A" digit means if base is less then 11? Could you transform "A1A" to base 10 from base... 7 for example? Thanks a lot, now I read the statement in a different way. |
| What was the trick in the 7th test? I cannot deal with it!!! | Игорь Степанов | 1427. SMS | 10 Apr 2017 22:05 | 10 |
Trick was with I\O. I held half of contest myselt trying to pass it. If you use C\C++, you may have the same bug. Reading scanf("%d%d\n",&n,&m); gets(a); got WA#7, but this code scanf("%d%d",&n,&m); gets(a); gets(a); got AC. Why? I don't know! But it would be better to learn more about this bug. What do you think about it? Safe Bird can you explain why his first code is wrong? scanf("%d%d\n",&n,&m) reads not only new line character but leading spaces in second line. If you use C++, you must know it! Don't mix up 'scanf' and 'gets' or you will have unpredictable am-I-before-or-after-EOL situations. If you have to use 'gets' in the problem, use ONLY 'gets', and use 'sscanf' to extract row elements from the string fetched via 'gets', or use 'strtok' if you don't know amount of elements beforehand. For this particular problem I wrote: gets(s); sscanf(s, "%d %d", &n, &m); gets(s); >> scanf("%d%d\n",&n,&m) reads not only new line character but leading spaces in second line. >> If you use C++, you must know it! Thank you for explain! :) Edited by author 12.08.2008 22:09 Thank you for your useful tip! I didn't find any document about this behavior. Your experience is really great. 2Igor E. Tuphanov Thank you! You are very helpful! |
| My solution :) C++ | competitivecoder | 2012. About Grisha N. | 10 Apr 2017 15:21 | 3 |
hey guys,this is my solution.Hope you like it :) C++. #include <bits/stdc++.h> using namespace std; queue<int>qu; //queue #define pii pair<int,int> //pair #define maxx 500 //maximum of anything vector<pii>vpii[maxx]; //Vector of pair #define inf 0x7fffffff //INFINITY int X[]={+2,+2,-2,-2,+1,-1,-1,+1}; //knight movement left/right int Y[]={-1,+1,-1,+1,+2,+2,-2,-2};//knight movement up/down int main() { int pr; while(cin>>pr){ int r=max(0,12-pr); int minutes=(4*60)-r*45; cout<<(minutes>=0?"YES\n":"NO\n"); } return 0; } Edited by author 03.06.2015 10:10 Edited by author 03.06.2015 10:10 in my country we use the following sentence for your kind of code :"turning food around head then eating it" i mean you are just overkilling such an easy question but i learnt a little trick from your code thanks for that |
| beware of special cases N=1, x=y | esbybb | 2109. Tourism on Mars | 9 Apr 2017 04:35 | 2 |
main { prepare_lca(); if (N!=-1) { build_segement_tree(1,0,N-2); //a[0..n-1] } int Q=read(); while(Q-->0) { int j=x; int x=read()-1; int y=read()-1; if (x!=y) { J= get(1, 0, N-2, x, y-1); } println(j); } } in build_segement_tree .. if (tl==tr) t[v]=lca(tl,tl+1); Segment tree is an overkill. Sparse table does the work easily. Without any corner cases. |
| Hint: This is graph shortest path. | xurshid_n | 2103. Corporate Mail | 7 Apr 2017 14:31 | 1 |
vertexes are 1..10 and d , d + 1, d-1, d+2, d-2, t + 3, t - 3, where d's are divisors of t. |
| give me some test, please !!! | Sunnat | 1684. Jack's Last Word | 6 Apr 2017 20:57 | 3 |
bbaabb bbaabba Edited by author 30.07.2013 23:27 |
| WA 4 | Jonnathan | 1723. Sandro's Book | 6 Apr 2017 20:50 | 2 |
WA 4 Jonnathan 25 Oct 2012 10:23 My Source import java.util.*; public class JavaApplication3 {
public static void main(String[] args) { String SubPalabra1=""; String SubPalabra2=""; String Correcta="";
String Verdadera=""; int menor; String resto=""; Scanner D=new Scanner(System.in); String palabra=D.nextLine().trim(); if(palabra.length()!=1){ for(int i=0;i<palabra.length();i++){ Verdadera=""; resto=palabra.substring(i+1, palabra.length()); if(resto.indexOf(palabra.charAt(i))!=-1){ SubPalabra1=""+palabra.charAt(i)+resto.substring(0,resto.length()); SubPalabra2=""+resto.substring(resto.indexOf(palabra.charAt(i)),resto.length()); if(SubPalabra1.length()<SubPalabra2.length()){ menor=SubPalabra1.length(); } else{ menor=SubPalabra2.length(); } for(int j=0;j<menor;j++){
if(SubPalabra1.charAt(j)==SubPalabra2.charAt(j)){ Verdadera=Verdadera+SubPalabra1.charAt(j); if(Verdadera.length()>Correcta.length()){ Correcta=Verdadera; } } else{ j=menor; } } }
} } else{ System.out.println(palabra); } System.out.println(Correcta);
} } Who is the word that no work? |
| A problem with the problem | LSBG | 1662. Goat in the Garden 6 | 6 Apr 2017 20:40 | 2 |
I have written solution that reached test 22 during the competition(I think it corresponds to 15th in offline mode) but now I have wa and i have run out of ideas. Can anyone give me a clue on this problem. Is there a problem with precision (I am making calculations with long double but use sqrt which is a bit unprecise). |
| Hint | IlushaMax | 2020. Traffic Jam in Flower Town | 6 Apr 2017 20:33 | 1 |
Hint IlushaMax 6 Apr 2017 20:33 |
| No subject | KAKTUS_OK | 1409. Two Gangsters | 6 Apr 2017 20:31 | 6 |
KTO NIBUD PONIMAET, KAK EE RESHIT #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << --b << " " << --a; return 0; } vot) |
| for them who have wa on #3 or #11 | amirani | 1688. Team.GOV! | 6 Apr 2017 01:19 | 3 |
Do not use "n/3" or "n div 3" or "input div 3" or "input/3". Do not use any division. while input n, n:=n*3 ; and then you won't have to divide at 3 every input; Sorry for bad english.If any questions please ask. |
| Why WA 1 I've counted 'a','ab','abc' and other subsequences and got satisfying to condition.... | IlushaMax | 1219. Symbolic Sequence | 6 Apr 2017 01:17 | 1 |
#include <bits/stdc++.h> using namespace std; int main() { string letter="abcdefghijklmnopqrstuvwxyz"; int k=letter.size(); int i1,i2,i3; string part,bigpart; for(i1=0;i1<k;i1++) { for(i2=0;i2<k;i2++) { for (i3=0;i3<k;i3++) { part=""; part.pb(letter[i1]); if(part[0]!=letter[i2]) part.pb(letter[i2]); else continue; if(part[0]!=letter[i3]&&part[1]!=letter[i3]) part.pb(letter[i3]); else continue; bigpart.pb(letter[i1]);bigpart.pb(letter[i2]);bigpart.pb(letter[i3]); } } } string ans=""; //cout<<bigpart.size()/3; while(ans.size()<1000000) { ans=ans+bigpart; } /*for (int i=0;i<1000000;i++) { cout<<ans[i]; }*/ int res=0; for (int i=0;i<1000000;i++) { if (ans.substr(i,1)=="a") res++; } cout<<res; return 0; } Maybe 1 test is a sort of tricky? Edited by author 06.04.2017 01:18 |
| Why wrong ? | Pranto Das | 1068. Sum | 5 Apr 2017 22:33 | 2 |
#include<stdio.h> #include<math.h> int main() { int N; scanf("%d",&N); int i,ck = 0; for(i = 2; i <= abs(N); i++) ck += i; if(N < 0) printf("-%d\n",ck); else printf("%d\n",ck); return 0; } |
| Should we multiply by k or n%k if (n - i*k) equals k or n%k ? | Simoren | 1083. Factorials!!! | 5 Apr 2017 22:28 | 3 |
Hello, Should we multiply by k or n%k if (n - i*k) equals k or n%k ? Which sample is correct? Sample 1 8!! = 8 *(8-2)*(8-4)*(8-6)*2 Sample 2 8!! = 8 *(8-2)*(8-4)*(8-6) |
| WA8 Rabin–Karp and AC with KMP | Zura Isakadze [Tbilisi SU] | 1423. String Tale | 5 Apr 2017 22:20 | 4 |
any idea what could be my mistake? i'm using i=n; i< 2n; i++ h2=((mod + h2 - dn * a[i-n] % mod) * d % mod + a[i]) % mod; where d=256, dn=d^(n-1) mod=10^9+9 i had WA8 with hashes, i had maxn = 250100, but it must be doubled for algo and it passed with 500100 Boyer-Moor algorithm gets TL6 - it works slower than naive substrings search! AC with KMP |
| WA 10 | 💻Evgeny Nemtsev [UrFU FT-17]'` | 1435. Financial Error | 5 Apr 2017 17:54 | 1 |
WA 10 💻Evgeny Nemtsev [UrFU FT-17]'` 5 Apr 2017 17:54 2 10 15 16 -> Unrecoverable error. (not "Error in record #1. Correct number is: 1.") |
| Ambiguity in statement | Ngo Huy | 1085. Meeting | 5 Apr 2017 10:18 | 1 |
if a route is defined by the stops: 1, 2, 4. Can they go from 4 to 2 then to 1 or is it one-way route? |
| Решение C++ | Solution C++ | Viktor | 1000. A+B Problem | 5 Apr 2017 03:23 | 1 |
#include <iostream> using namespace std; int main(){ unsigned int a, b; cin >> a >> b; cout << a+b; return 0; } |
| Решение C | Solution C | Viktor | 1000. A+B Problem | 5 Apr 2017 03:22 | 1 |
#include <stdio.h> int main(){ int a, b; scanf("%d %d", &a, &b); printf("%d", a + b); return 0; } |
| answer/ответ Java | Vinchester | 1820. Ural Steaks | 4 Apr 2017 19:00 | 1 |
import java.util.Scanner; public class Zadachi { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int x = 2; if(n<=k){ System.out.print(x); }else{
if (n*2 % k == 0){ System.out.print(n*2/k); }else{ System.out.print(n*2/k+1); } }
} } |