| Show all threads Hide all threads Show all messages Hide all messages |
| RuntimeError (1001. Обратный корень) | don`t_even_you | 1001. Reverse Root | 25 Sep 2014 01:58 | 1 |
import java.util.*; import java.text.*; public class Test{ public static void main(String args[]){ Scanner in = new Scanner(System.in);
String s;
s = in.nextLine();
char c;
int i = 0;
Double [] mass = new Double [256];
String st = "";
for(int j = 0; j < s.length(); j++){ c = s.charAt(j);
if(c == ' ' || j == s.length() - 1){ //реализация вывода корня mass[255 - i] = Double.valueOf(st);
i++;
st = ""; }
if(c != ' ') st += c; }
DecimalFormatSymbols symbol = new DecimalFormatSymbols(); symbol.setDecimalSeparator('.'); DecimalFormat f = new DecimalFormat("#,##0.0000", symbol);
for(Double d: mass){ if(d != null){ System.out.println(f.format(Math.sqrt(d))); }
} } } Edited by author 25.09.2014 02:00 |
| How to calculate the expected number. | Dextrom | 1887. Frequent Flyer Card | 24 Sep 2014 22:16 | 4 |
When probability from 0~9 different, how to calculate the expected number??? Thank very much!! I have used Dynamic Programming. To do this, you need to store 2^10 states ... I have used Dynamic Programming to get probability. But don't know how to get EP. If probability is equal it's a coupon collector's problem? Please, explane this in more details. |
| Time limit #11 | bilac | 1100. Final Standings | 24 Sep 2014 00:39 | 1 |
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Scanner; import java.io.BufferedReader; import java.io.InputStreamReader; public class hgg { /** * @param args */ public static ArrayList<concho> listcho = new ArrayList<concho>(); public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int a = sc.nextInt(); for (int i = 0; i < a; i++) { listcho.add(new concho(sc.nextInt(),sc.nextInt())); } Collections.sort(listcho, new Comparator<concho>() { public int compare(concho o1, concho o2) { // TODO Auto-generated method stub if(o1.kg<o2.kg) return 1; if(o1.kg>o2.kg) return -1; return 0; } }); for (concho item : listcho) { System.out.println(item.tuoi+" "+item.kg); } } public static class concho { int tuoi; int kg; public concho(int t, int k) { tuoi=t; kg=k; } } } |
| Help. Runtime error (access violation) | Daniel | 1021. Sacrament of the Sum | 23 Sep 2014 15:45 | 2 |
Where is my wrong? Why runtime error (access violation)? This is my code- program _1021; var n,i,k,l,m:integer; a,b:array[1..10000] of integer; begin read(n); for i:=1 to n do read(a[i]); read(m); for k:=1 to m do read(b[k]); for i:=1 to n do for k:=1 to m do if a[i]+b[k]=10000 then l:=l+1; if l>=1 then writeln('YES') else writeln('NO'); end. ... a,b:array [1..10000] of integer;... 10000 isn't enough because 1<=n<=50000 |
| WA #1 | mikhsatyshev | 2002. Test Task | 23 Sep 2014 15:19 | 1 |
WA #1 mikhsatyshev 23 Sep 2014 15:19 I don't understand why WA #1 because I fully tested answer of mu programm and answer on site. They hasn't got differences! Even invisible characters. Here is my code: var n,i,j,fl,k,n1:longint; a,b,d,x:string; y,z:array [1..100] of string; z1:array [1..100] of byte; c:char; begin readln (n); for i:=1 to n do begin fl:=0; a:=''; b:=''; d:=''; readln (x); n1:=length (x); j:=0; repeat j:=j+1; If x[j]<>' ' then a:=a+x[j]; until x[j]=' '; repeat j:=j+1; If x[j]<>' ' then b:=b+x[j]; until x[j]=' '; repeat j:=j+1; If x[j]<>' ' then d:=d+x[j]; until j>=n1; fl:=0; If a='register' then begin for j:=1 to k do If b=y[j] then fl:=1; If fl=1 then writeln ('fail: user already exists') else begin writeln ('success: new user added'); k:=k+1; y[k]:=b; z[k]:=d; z1[k]:=0;end;end; fl:=0; If a='login' then begin for j:=1 to k do If b=y[j] then fl:=j; If fl=0 then writeln ('fail: no such user') else If (fl>0) and (d<>z[fl]) then writeln ('fail: incorrect password') else If (fl>0) and (d=z[fl]) and (z1[fl]=1) then writeln ('fail: already logged in') else begin writeln ('success: user logged in'); z1[fl]:=1;end;end; fl:=0; If a='logout' then begin for j:=1 to k do If b=y[j] then fl:=j; If fl=0 then writeln ('fail: no such user') else If (fl>0) and (z1[fl]=0) then writeln ('fail: already logged out') else begin writeln ('success: user logged out'); z1[fl]:=0;end;end;end; end. |
| test 4# plzz | Shubham Murarka | 1131. Copying | 20 Sep 2014 19:52 | 2 |
|
| question about ranking | TwoEightNine | | 19 Sep 2014 22:00 | 2 |
for exmple, i solved a problem when its rank was 300, and now its one is 200. does it mean that my rank decreased for 100??? The problem difficulty is calculated by the formula depending on the number of authors who have solved it and the age of the problem. The fewer new authors solve the problem per unit of time, the greater the difficulty. The difficulties of all problems are updated every night. Author rating is the sum of the difficulties of all his solved problems from the archive. |
| Python variation | JollyGirl.py | 1068. Sum | 19 Sep 2014 18:52 | 1 |
x = int(input()) print(sum(range(min(1,x),max(1,x)+1))) |
| to admins: yet another test | TwoEightNine | 1820. Ural Steaks | 19 Sep 2014 09:36 | 1 |
my first solution got ac, but with my test 3 78 it wrote 1 i think you should add some tests |
| use Floyd-Warshall algorithm | idiot123 | 1004. Sightseeing Trip | 18 Sep 2014 13:08 | 1 |
I read this algorithm in INTRODUCTION OF ALGORITHM at chapter 25.If you had already read this algorithm,you can easily solve this problem. |
| Got Wrong Answer on Test3 | Gevorg Soghomonyan | 1133. Fibonacci Sequence | 17 Sep 2014 21:25 | 3 |
Does anyone what's the test 3????? Edited by author 25.09.2012 09:12 its if n equals to i or j |
| WHAT IF n > k ???? | Me | 1009. K-based Numbers | 17 Sep 2014 01:52 | 1 |
For example, I have n = 3 and k = 2, which means 0 and 1 Then there is 3 possible ways to made a number: 101, 111, 110 How to calculate this moment, when n is more than k????? |
| wht is wrong?? visual C | Shubham Murarka | 1196. History Exam | 16 Sep 2014 23:44 | 1 |
#include<stdio.h> int main() { int n, i, j; long int m; long long int pro[15000], stu[15000]; int count = 0; scanf("%d", &n); for (i = 1; i <= n; i++) { scanf("%lld\n", &pro[i]); } scanf("%ld\n", &m); for (i = 1; i <= m; i++) { scanf("%lld\n", &stu[i]); for (j = 1; j <= n; j++) { if (stu[i] == pro[j]) count++; } } printf("%d", count); return 0; } |
| всем | kostan3 | | 16 Sep 2014 21:36 | 4 |
всем kostan3 4 Sep 2014 21:12 мой e-mail beikon@spaces.ru vk.com/eto97 будут вопросы задавайте отвечу Re: всем Vedernikoff 'Goryinyich' Sergey (HSE: АОП) 4 Sep 2014 22:53 One question here: could you please stop flooding forum with worthless stuff? Because shortest solutions for the most trivial problems on timus is not interesting, really. How about writing shortest solution for this problem, for example: http://acm.timus.ru/problem.aspx?space=1&num=1408прости что на русском спасибо учту |
| wa#2 come in | Huang WenHao | 1126. Magnetic Storms | 16 Sep 2014 19:36 | 5 |
I have wa#2 for many times, but at last I have done it. If you are in same situation, notice M can be larger than N. You should output something - the largest number in 1..N. It's can't be. I have wa#2 for many times, but at last I have done it. If you are in same situation, notice M can be larger than N. You should output something - the largest number in 1..N. I have wa#2 for many times, but at last I have done it. If you are in same situation, notice M can be larger than N. You should output something - the largest number in 1..N. Another reason could be data-type not able to hold values in the range of 0 and 100000 M is always less or equal to N man, read the problem once more for assurance and also i don't think that WA can be cause of data-type which can't hold values from 0 to 10^6..simple "integer/int" is ok man. test case 2 has exactly 25000 measured values.... eg- 3 10 11 1 19 ... ... ... (25000 integers) -1 so,be careful in declaring the size of array... :)(you can use arr[25001] ). |
| WA 5 :( | esraa.ali | 1210. Kind Spirits | 15 Sep 2014 05:41 | 1 |
WA 5 :( esraa.ali 15 Sep 2014 05:41 can i have test 5 please I`m sure that my solution is correct, but I have WA on 5 test... My solutions can pass all the tests shown Please, give me test 5 ,or some tricky tests! Thanks a lot! |
| Wrong answer (c++) | Igor | 1001. Reverse Root | 14 Sep 2014 20:43 | 2 |
#include<iostream> #include<stack> #include<iomanip> #include<math.h> using namespace std; int main() { stack<int> a; int i,n(0),temp; while (cin >> temp) { n++; a.push(temp); }; for (i=0;i<n;i++) { cout << fixed << setprecision(4) << sqrt(double(a.top())) << endl; a.pop(); }; return 0; }; what is the problem? Edited by author 19.08.2014 17:38 Try the sample input on your solution, I think it will fail. 1427 0 876652098643267843 5276538 |
| WA3: What can it be? Plese help | BinaryMind [RAU] | 1220. Stacks | 13 Sep 2014 10:52 | 2 |
You can post blogs to codeforces or topcoder or etc. |
| WA test #15 | Kamaldinov Dmitry | 1106. Two Teams | 12 Sep 2014 23:03 | 1 |
|
| AC with segment tree in O(N*log(32000)) | Levon Oganesyan | 1028. Stars | 12 Sep 2014 12:18 | 1 |
|