Show all threads Hide all threads Show all messages Hide all messages |
есть у кого контрпример? | Anonymous | 2061. OEIS A216264 | 22 Jul 2015 18:42 | 3 |
Кто в теме, приведите хотя бы один пример НЕбогатой строки. Буду признателен Спасибо. И поздравляю как первого (и пока единственного) решившего) |
I've got WA 4 | Muravjev Slava [Samara SAU] | 1050. Preparing an Article | 22 Jul 2015 14:00 | 2 |
Give me some tests or advices, please. Got WA4, cause ignore situation \par" Input: There is no "q in this sentence. \par" "Talk child," said the unicorn. She s\"aid, "\thinspace `Enough!', he said." \endinput Output: There is no q in this sentence. \par`` ''Talk child, said the unicorn. She s\"aid, ``\thinspace `Enough!', he said.'' \endinput |
Problem without problem statement!!! | [SPbSU ITMO] MAKAPOB | 1201. Which Day Is It? | 21 Jul 2015 22:27 | 3 |
To admins: please add some rules, which format of output should be, because this example from one month shows me nothing. 1) number of spaces must be 3 everywhere except 1,2,3,4,5,6,7,8,9? 2) we must count day of week using normal calender? Rules about it are full, or some items are omitted??? 3) What is in test 10?? P.S. Is this correct for: 7 1 2006 mon.......2....9...16...23...30 tue.......3...10...17...24...31 wed.......4...11...18...25 thu.......5...12...19...26 fri.......6...13...20...27 sat.....[.7]..14...21...28 sun...1...8...15...22...29 Or correct is: mon........2....9...16...23...30 tue........3...10...17...24...31 wed........4...11...18...25 thu........5...12...19...26 fri........6...13...20...27 sat......[.7]..14...21...28 sun...1....8...15...22...29 ????? I mean number of spaces. Edited by author 03.03.2007 11:41 I think you should not count space characters but rather use alignment like in sample. The problem is that there is no information about this case in samples. |
whats wrong here please ? | MyName | 1001. Reverse Root | 21 Jul 2015 18:24 | 2 |
#include <iostream> #include <string> #include <cstdlib> #include <cmath> #include <sstream> #include <vector> #include <stdio.h> using namespace std; int main() { string s=""; vector <long double> vec; cout<<vec.size(); long double j; char c; stringstream ss(""); for (int i=0;i<256000;i++)//This is here so I can handle the size of the stream input { cin.get(c); s+=c; } //Now I know I am working on 256KB ss<<s; while(ss>>j) { j=sqrt(j); vec.push_back(j); } for (int k=vec.size()-1;k>=0;k--) { cout.precision(4); cout<<fixed<<vec[k]<<endl; } return 0; } I should add a test, if we are in the end of file before the 256000. Otherwise, it'll wait for 256000 char to enter |
java AC in the top of ranks | esbybb | 1413. Mars Jumper | 21 Jul 2015 11:37 | 1 |
InputStream is = System.in; byte[]b = new byte[1000_001]; int L = is.read(b)-1; while(b[L]<48 || b[L]>57) L--; int i=0; double D = Math.sqrt(0.5); double x=0; double y=0; // 1 2 3 4 5 6 7 8 9 double[] shftx = new double[]{0,-D, 0, D,-1, 0, 1,-D, 0, D}; double[] shfty = new double[]{0,-D,-1,-D, 0, 0, 0, D, 1, D}; while(i<=L && b[i]!=48 && b[i]!=0){ x+=shftx[b[i]-48]; y+=shfty[b[i]-48]; i++; } System.out.println(String.format("%.10f %.10f", x, y)); |
wa3 | Fyodor Menshikov | 1721. Two Sides of the Same Coin | 20 Jul 2015 13:25 | 2 |
wa3 Fyodor Menshikov 31 Oct 2010 01:44 Pairs in output should be ordered: in each pair first the name of a person writing the statement and then the name of a person preparing the tests. Solution printing unordered pairs gets wa3. Re: wa3 Zakharov Konstantin 20 Jul 2015 13:25 My solution got wa1 because of this)) |
Any hints for wa-4? | Mullabaev | 1434. Buses in Vasyuki | 18 Jul 2015 15:07 | 1 |
|
WA14 | sherbina_evgeniy | 1721. Two Sides of the Same Coin | 17 Jul 2015 23:34 | 1 |
WA14 sherbina_evgeniy 17 Jul 2015 23:34 I got WA 14. I don't understand why? Please give me some tests or explain where is my mistake. |
Где ошибка? С++ | NoNSoS | 1068. Sum | 16 Jul 2015 12:49 | 1 |
#include <iostream> using namespace std; int main (){ int a; int sum; cin >> a; if (a<1 && a>=-10000){ for (int i = 1; i >= a; i--){ sum = sum + i; }; } else if (a>=1 && a<=10000) { for (int i = 1; i <= a; i++){ sum = sum + i;
}; }; cout << sum; return 0; } при: N(a) -- sum 10000 -- 50005000 1 -- 1 0 -- 1 -1 -- 0 -3 -- -5 -10000 -- 50004999 Edited by author 16.07.2015 12:55 Edited by author 16.07.2015 12:56 |
What is wrong? Что не так? // С++ | Kelife | 1000. A+B Problem | 15 Jul 2015 21:22 | 4 |
#include <iostream> using namespace std; int main() { int a, b; cout << "Enter 'a': "; cin >> a; cout << '\n'; cout << "Enter 'b': "; cin >> b; cout <<'\n'; cout << a + b; return 0; } Edited by author 07.06.2015 21:38 Edited by author 07.06.2015 21:38 Don't output "Enter a" or something like that Don't output "Enter a" or something like that Значения a и b вводятся через пробел, поэтому надо использовать только cin >> a >> b; |
Please, help! | Shaft | 1327. Fuses | 15 Jul 2015 20:05 | 1 |
I can't understand what's wrong in my code, it write 51 instead of 50 #include <iostream> using namespace std; int main() { unsigned short a, b, c; cin >> a >> b; c = (b - a) + 1; if(c % 2 == 0) cout << c / 2; else cout << (c / 2) + 1; /// 1! 2 3! 4 5! 6 7! 8 9! 10 11! 12 13! 14 15! return 0; } |
THis is supposed to work. What is wrong? | Luigi Brito | 1001. Reverse Root | 15 Jul 2015 11:29 | 3 |
#include <stdio.h> #include <math.h> main() { int a=0; float b=0; while (!feof(stdin)) { scanf("%d", &a); b=sqrt(a); if (feof(stdin)) printf("%.4f\n",b); } } It works fine at my PC. But it keeps saying wrong answer? #include <stdio.h> #include <math.h> main() { int a=0; float b=0; while (!feof(stdin)) { scanf("%d", &a); b=sqrt(a); printf("%.4f\n",b); } } You should use a long long data type, because the int type supports only 2^32 as max. Please, read the contraints of the problem. There says that the number could be as big as 10^18 (a lot bigger than 2^32). Try with long long. Hope it be useful for you. |
Подводные камни "1001.Обратного корня" | Yegor | 1001. Reverse Root | 15 Jul 2015 02:35 | 2 |
//if 'double s[130196]' before 'int main()' - all is OK!! //but if 'double s[130196]' in 'int main()' then Runtime error (stack overflow)!!!!!!! //------------------------------------------------- //AND MAGIC №2: //any number after 130196 (for example 130196,130197...) in 'double s[130196]' - all is OK!! //BUT numbers before 130196, for example 130195, 130194... then Runtime error (access violation)!!! //------------ //on the internet people use 'double s[131072]' - it is 2^17, why???? if i can use 130196 //------------------ #include <iostream> #include <iomanip> #include <cmath> using namespace std; double s[130196];// if 130195 or < then Runtime error (access violation)!!! int main() { //double s[130196]; - if in 'int main()' then Runtime error (stack overflow) int t = 0; while (cin>>s[t]){t++;} while(t>0){cout<<fixed<<setprecision(4)<<sqrt((double)s[--t])<<endl;} return 0; } //why why why ??)) Edited by author 14.07.2015 17:12 Array from main function is kept in stack memory, and this memory is limited. You should declare it as global, or increase stack size. |
Runtime error in Java 1.7 test 2 help me please | Axmadjon | 1370. Magician | 14 Jul 2015 22:30 | 2 |
import java.util.Scanner; public class _1370 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int digitos = in.nextInt(); int cliques = in.nextInt(); String saida = ""; String parte2 = ""; for (int i = 1; i <= cliques; i++){ saida += in.nextInt(); } for (int i = cliques+1; i <= digitos; i ++){ parte2 += in.nextInt(); } parte2 += saida; System.out.println( parte2.substring(0,10) ); } } you are using in.nextInt() to get the input from the user for a String. That is used for integers. You should be using in.next() or in.nextLine() for String. |
WA 5 | Ivan | 1242. Werewolf | 14 Jul 2015 21:46 | 1 |
WA 5 Ivan 14 Jul 2015 21:46 Can anybody send me the fifth test of this problem? My program always crushes on it. I think it's something wrong when input my data int size; struct point{ int number; bool pr; }; vector<point> matrix[1000]; int main(){ int name1, name2; point c; char hg='0'; vector<int> victims; cin >> size; while (hg != 'B'){ cin >> hg; if (hg != 'B'){ cin >> name2; name1 = atoi(&hg); c.pr = true; c.number = name2 - 1; matrix[name1 - 1].push_back(c); c.pr = false; c.number = name1 - 1; matrix[name2 - 1].push_back(c); } } for (int i = 0; i < 4; i++) cin >> hg; while (std::cin >> name1) victims.push_back(name1 - 1); |
Tests | Felix_Mate | 1465. Pawn Game | 14 Jul 2015 15:22 | 1 |
Tests Felix_Mate 14 Jul 2015 15:22 987654321 => white 123456789 => white 666 => black 999 => white 8 => black 13 => white 19 => white 5 => white Edited by author 26.12.2015 22:50 |
No subject | MD MOINUL HOSSAIN | 1585. Penguins | 14 Jul 2015 02:07 | 1 |
|
WA 1!!! HEEEEEEEELP!!! | Felix_Mate | 1684. Jack's Last Word | 13 Jul 2015 18:59 | 1 |
I can't find any error. My program solve all tests,my I got WA1!!! My code: var Z:array[1..151000] of longint; A,C:array[1..151000] of char; N,L,R,i,j,k,ind,M,t:longint; ch:char; find:boolean;
function Min(x,y:longint):longint; begin if(x>y) then x:=y; Min:=x; end;
BEGIN N:=0;
ch:='a'; while(ord(ch)>50) do begin read(ch); if(ord(ch)>50) then begin inc(N); A[N]:=ch; end; end;
A[N+1]:='+'; ind:=N+1; inc(N); readln;
ch:='a'; while(ord(ch)>50) do begin read(ch); if(ord(ch)>50) then begin inc(N); A[N]:=ch; end; end;
Z[1]:=N; R:=0; L:=0;
for i:=2 to N do begin if(i<=r) then Z[i]:=min(R-i+1,Z[i-L+1]) else Z[i]:=0; while(i+z[i]<=N)and(A[i+z[i]]=A[z[i]+1]) do inc(z[i]); if(i+z[i]-1>r) then begin L:=i; R:=i+z[i]-1; end; end;
find:=true; i:=N; while(i>=ind+1) do begin k:=i; while(i>=ind+1)and(Z[i]<k-i+1) do dec(i); if(i<ind+1) then find:=false; dec(i); end;
if(find) then begin writeln('No '); i:=N; M:=1; while(i>=ind+1) do begin k:=i; while(i>=ind+1)and(Z[i]<k-i+1) do dec(i); t:=M; for j:=k downto i do begin C[t]:=A[j]; inc(t); end; C[t+1]:=' '; M:=t+2; dec(i); end;
for i:=M-2 downto 1 do begin write(C[i]); end; end else begin write('Yes'); end; END.
|
I use DFS, how to solve it by DP? | hliu20 | 1437. Gasoline Station | 13 Jul 2015 10:21 | 2 |
DFS, record the state, if come into a state appeared before , ignore it. DFS is very slow, can anybody give some hints to DP? Это и есть ДП. Ведь ты переходишь по сути в известные состояния(т.е.уже просмотренные) и новые,для которых рассматриваешь переходы.Просто у нас не совсем стандартные размерности "подзадачи". ДП-это не только реккурентные соотношения. |
How to make this code faster?? Please, help | Najmaddin Akhundov | 1073. Square Country | 12 Jul 2015 10:39 | 4 |
#include <iostream> #include <cmath> #include <algorithm> using namespace std; int function(int n) { if (n == 1) return 1; else if (n == 0) return 0; else{
int k = 999999999; for (int i = 1; i <= sqrt(n); i++) { int a = function(n - i*i); if (a < k ) k = min(k, a); } return function(k) + 1;
}
} int main() { int n; cin >> n; cout << function(n) << endl; } Thank you Noob, I got an AC with your help. One optimization No need to start loop from always from 1 , sqrt(N)/2 is enough ;) thing why?. :) |