| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Why wrong ? | Pranto Das | 1068. Сумма | 5 апр 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. Факториалы!!! | 5 апр 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. Басня о строке | 5 апр 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. Финансовая ошибка | 5 апр 2017 17:54 | 1 |
WA 10 💻Evgeny Nemtsev [UrFU FT-17] 5 апр 2017 17:54 2 10 15 16 -> Unrecoverable error. (not "Error in record #1. Correct number is: 1.") |
| Ambiguity in statement | Ngo Huy | 1085. Встреча | 5 апр 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 апр 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 апр 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. Уральские бифштексы | 4 апр 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); } }
} } |
| не могу понять, почему не принимает програму (задача 1243) | Bohdan | | 4 апр 2017 14:49 | 4 |
#include <iostream> #include <math.h> using namespace std; int main() { char N[51]; cin >> N; int i; for (i = 0; N[i] != '\0'; i++); char Y[4]; int counter = 0, a = 0; if (i % 3 == 0) { for (int j = 0; j < i; j += 3) { Y[0] = N[j]; Y[1] = N[j + 1]; Y[2] = N[j + 2]; Y[3] = 0; if (counter % 2 == 0) { int temp = atoi(Y); a += temp; } if (counter % 2 == 1) { int temp = atoi(Y); a -= temp; } counter++; } } if (i % 3 != 0) { int start = i % 3; for (int maloe = 0; maloe < start; maloe++) { Y[maloe] = N[maloe]; } Y[start] = '\0'; int temporary = atoi(Y); a -= temporary; int counter = 0; for (int j = start; j < i; j += 3) { Y[0] = N[j]; Y[1] = N[j + 1]; Y[2] = N[j + 2]; Y[3] = 0; if (counter % 2 == 0) { int temp = atoi(Y); a += temp; } if (counter % 2 == 1) { int temp = atoi(Y); a -= temp; } counter++; } } cout << abs(a%7); system("pause"); return 0; } Я делаю ввод в строку, тогда считываю по 3 элемента и делаю их один числом (например, 123456 в числа 123 и 456), тогда по признаку деления на 7 узнаю остаток. Если число, например 12435 то я делю его на 12 и 435 и по работаю по тому же принципу. На моих проверках всё работает хорошо, а система выдаёт WA на 3 тесте. Could you please open task-related themes in task discussions rather than common? Could you please publish link to mathematical background of your solution? Btw, Test your solution on numbers 222223 and 223222. Could you please read task discussions and find simple division digit-by-digit in the every second topic? Edited by author 26.03.2017 23:20 Сударь, вы очень-очень мудрёно решаете. Код этой задачи - в несколько строк. |
| seems there is illegal tests | Shen Yang | 2016. Магия и наука | 4 апр 2017 14:14 | 2 |
1 1 366 -565864 609690 15155 516588 775970 765044 814205 -251004 532061 magion will stop in the middle of second args...please check it sorry ,it's my mistake,answer should be 8587308.19597172360000000000 |
| Решение C++ | Solution C++ | Viktor | 1068. Сумма | 4 апр 2017 11:39 | 2 |
#include <iostream> using namespace std; int main(){ int n, i = 0; cin >> n; while (n != 1){ if (n <= 1){ i+= n; n++; } else if (n >= 1){ i+= n; n--; } } cout << i+1; return 0; } |
| Решение C | Solution C | Viktor | 1068. Сумма | 4 апр 2017 04:37 | 1 |
#include <stdio.h> int main() { int n, i = 0; scanf("%d", &n); while (n != 1){ if (n <= 1){ i+= n; n++; } else if (n >= 1){ i+= n; n--; } } printf("%d", i+1); return 0; } |
| I think it is not geometry problem ->>>>>PHYSICS problem | IlushaMax | 1192. Мячик во сне | 3 апр 2017 23:19 | 1 |
|
| LOL O(N*M) works...without any data structures | IlushaMax | 1126. Магнитные бури | 3 апр 2017 22:51 | 1 |
|
| WA #6 | pidgey | 1126. Магнитные бури | 2 апр 2017 17:42 | 1 |
WA #6 pidgey 2 апр 2017 17:42 Can someone please tell how the test looks like? |
| Wooohooooooooo AC ->some hints | IlushaMax | 2033. Девайсы | 31 мар 2017 17:23 | 1 |
Don't forget about saving MIN PRICE of device Edited by author 31.03.2017 17:39 |
| Something strange... | Vukasin | 1023. Пуговицы | 31 мар 2017 14:16 | 3 |
When i write my program like: #include<cstdio> long long int i,k; int main(){ scanf("%lld",&k); i=k / 3; while(k % i!=0){ i=k /(k / i +1); } i got AC,but when i change it to: #include<cstdio> int main(){ long long int i,k; scanf("%lld",&k); i=k / 3; while(k % i!=0){ i=k /(k / i +1); } printf("%lld",(k / i-1)); } printf("%lld",(k / i-1)); } i got WA5...does anyoe know how is that possible? wtf i=k / 3; ?? If k%(l+1)==0 then 2nd have a chance to win. And 1st wins if k%(l+1)!=0 try it: for (l=3;k%l!=0;l++);; Edited by author 31.03.2017 14:34 |
| WA #13? | Ionkin M [Samara SAU #617] | 1023. Пуговицы | 31 мар 2017 13:30 | 1 |
WA #13? Ionkin M [Samara SAU #617] 31 мар 2017 13:30 Check your program for very big K. It helped me. Edited by author 31.03.2017 14:38 |
| I guessed - can someone explain why? | Steve | 1161. Stripies | 30 мар 2017 21:34 | 4 |
I got AC on this simply by guessing that combining the stripies from the largest down to the smallest would result in the smallest colony size. Can someone explain what mathematical or logical reasoning would be used to arrive at this conclusion, or prove that this conclusion would be true? I guessed the same and also I want to know mathematical proof The factor 2 does not matter -- you will always find one 2 which was sqrt'ed (n-1) times, ..., one 2 not sqrt'ed. OOH, there will be exactly two given number which got sqrt'ed (n-1) times, ..., one given number that got sqrt'ed once. Therefore, you will want larger numbers be sqrt'ed more times. Edited by author 22.03.2016 12:08 I can explain Okay, we have sequence m1,m2,m3,m4.... of weights in input But now imagine that we have a heap of stripies with their weights. Our answer (for example n=4) will be: 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) for greater understanding write it on a sheet. So we need to maximize it but we don't know order of m1,m2,m3,... which give max answer. It's clear that if 2*sqrt(m1*2*sqrt(m2*2*sqrt(m3*m4))) should be maximum then m1*2*sqrt(m2*2*sqrt(m3*m4)) (in sqrt) should be maximum too. Reasoning in this way we understand that we need m3*m4 be maximum. So this sequence should be sorted in this way: m4>=m3>=m2>=m1 I hope my English is enough to explain it)))) Edited by author 31.03.2017 19:50 |
| If you use P(P+2A-1)=2N but have WA | IlushaMax | 1120. Сумма последовательных чисел | 30 мар 2017 20:40 | 2 |
Don't forget that not only P should be divider of 2N but P+2A-1 should be divider of 2N too. It was my mistake when I got WA 7 Thanks! Nikita UCSD Pascal 30 мар 2017 20:40 |