| Show all threads Hide all threads Show all messages Hide all messages |
| answer c# | >OWL< | 1197. Lonesome Knight | 17 Jan 2016 14:35 | 1 |
using System; class Program { static void Main() { int n = int.Parse(Console.ReadLine()); string[] move = new string[n]; for(int i = 0; i < n; i++) { move[i] = Console.ReadLine(); } for(int i = 0; i < n; i++) { if(move[i][0] >= 'c' && move[i][0] <= 'f' && move[i][1] >= '3' && move[i][1] <= '6') { Console.WriteLine(8); } else if(((move[i][0] == 'b' || move[i][0] == 'g') && move[i][1] >= '3' && move[i][1] <= '6') || ((move[i][1] == '2' || move[i][1] == '7') && move[i][0] >= 'c' && move[i][0] <= 'f')) { Console.WriteLine(6); } else if(move[i] == "a1" || move[i] == "a8" || move[i] == "h8" || move[i] == "h1") { Console.WriteLine(2); } else if((move[i][0] == 'a' && (move[i][1] == '2' || move[i][1] == '7')) || (move[i][0] == 'b' && (move[i][1] == '1' || move[i][1] == '8')) || (move[i][0] == 'g' && (move[i][1] == '1' || move[i][1] == '8')) || (move[i][0] == 'h' && (move[i][1] == '2' || move[i][1] == '7'))) { Console.WriteLine(3); } else Console.WriteLine(4); } } } |
| Picture gives examples of staircase | alp | 1017. Staircases | 16 Jan 2016 20:32 | 3 |
Autors! you are wrong. fix please. It's allright! You cannot have two neighbour stair steps with horizontal difference more than 1. |
| What are Union-Find/Disjoint Set Timus Problems? | alekscooper | | 16 Jan 2016 17:37 | 1 |
Hello guys, I've just started learning algorithms and I've read a piece from R. Sedgewick's book on Algorithms about Union Find. I'd love to practice it. Could anyone recommend any problems here? Thanks. |
| WA8 Why? | Vincent Kotwizkiy [SESC] | 1636. Penalty Time | 15 Jan 2016 21:23 | 2 |
WA8 Why? Vincent Kotwizkiy [SESC] 31 Mar 2013 04:40 Can anybody give me test 8? Code on python2: a, b = map(int, raw_input().split(' ')) k = 0 c = map(int, raw_input().split(' ')) for x in xrange(1,10): k = k+c[x]*20 if b-k>a: print('No chance.') elif b-k<a: print('Dirty debug :(') elif b-k==a: print('No chance.') xrange(1, 10) only takes array elements 1-9. You need to use xrange(0, 10) to get elements 0-9 |
| Just use next_permutation() in C++! | GastonFontenla | 2011. Long Statement | 15 Jan 2016 17:36 | 1 |
next_permutation() generates distinct permutations of a given iterable object (vector, string, etc). Just make 6 permutations, and save each of them in a set<vector<int> >. Finally, check if the size of the set is 6, because the set only saves different elements. Pretty easy solution. |
| Follow your friends on Timus! (Chrome extension) | 🦄 Slava Shklyaev | | 15 Jan 2016 02:02 | 1 |
|
| WA#13 FreePascal | Desire | 1964. Chinese Dialects | 14 Jan 2016 04:03 | 3 |
Here is my code. What is wrong? Help, please! var m,n:int64; k,i:0..20; a:array[1..20] of int64; begin read(n,k); for i:=1 to k do read(a[i]); for i:=2 to k do if a[i]<a[i-1] then begin m:=a[i]; a[i]:=a[i-1]; a[i-1]:=m end; m:=n-(n-a[1])-(n-a[2]); if m<=0 then write(0) else write(m); end. Edited by author 02.11.2013 04:21 You must only write((a1+a2+...+ak)-n) That's all)) Good luck! no, right answer is ((a1+a2+...+ak)-n * (k-1)) |
| C++ What's wrong with my code? | zimozi | 2001. Mathematicians and Berries | 14 Jan 2016 00:40 | 4 |
#include <iostream> using namespace std; int main() { int a[3],b[3]; for (int i = 0;i<3;i++) {cin>>a[i]>>b[i]; } cout<<a[0]-a[2]<<b[0]-b[1]; return 0; } Where am I must write the space? Only in output? between ans1 << " " << ans2; |
| Compilation eror in java | Sazid Hasan | 1000. A+B Problem | 14 Jan 2016 00:09 | 1 |
i can not submit my solution by java |
| Java | Arheus | 1000. A+B Problem | 14 Jan 2016 00:05 | 6 |
Java Arheus 28 Aug 2014 01:04 What is wrong? import java.util.*; public class Main { public static void main(String[] args){ int a,b = 0;
Scanner in = new Scanner(System.in);
System.out.println("First num"); a = in.nextInt(); if(a==1){ System.out.println("Second num"); b = in.nextInt();} if(b==5){ System.out.println(a+b); } } } You should not write any other message than the expected output. How should the compiler know that writing "First num" and "Second num" isn't part of the problem result? Edited by author 29.08.2014 23:25 Re: Java wyq358171691@sina.com 11 Sep 2014 09:00 What is the problem import java.util.Scanner; public class Summa { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan=new Scanner( System.in); System.out.println("Введите значение a"); int a; a=scan.nextInt(); System.out.println("Введите значение b"); int b; b=scan.nextInt(); System.out.println(" a + b = " + (a + b)); } } You should not write any other message than the expected output. what is the problem? package Acm; import java.util.Scanner; public class Num { public static void main(String[] args) { // TODO Auto-generated method stub Scanner numscanner = new Scanner(System.in); int a = numscanner.nextInt(); int b = numscanner.nextInt(); System.out.println(a + b); } } |
| AC in 4 line without input | [RISE] Levon Oganesyan [RAU] | 1161. Stripies | 12 Jan 2016 23:27 | 2 |
|
| TLE 6 | raven | 1900. Brainwashing Device | 11 Jan 2016 18:29 | 1 |
TLE 6 raven 11 Jan 2016 18:29 Isn't Test#5 the n=500 one? |
| hint for WA 3 | BORODA | 1495. One-two, One-two 2 | 11 Jan 2016 06:53 | 3 |
the answer is 2 , isn't it? |
| If WA#9 | Timur Sitdikov (MSU Tashkent) | 1380. Ostap's Chess | 11 Jan 2016 03:38 | 2 |
If WA#9 Timur Sitdikov (MSU Tashkent) 15 Jul 2011 10:26 Try this: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 -3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 White c6-d7 Incorrect 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 -3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 I had WA9 because i thought there would be only one king of the same color, but seems like actually there might be more. Thankfully to take more kings into account i had to delete some of my code rather than add some. An example test: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 6 0 6 0 0 0 0 0 1 White <any move> (for example a1-a2 or c1-c2) The answer is "Incorrect" and then a table, because no matter what white does, there's at least one king remaining under check. Also had WA7 because of using shortint and a bit too small constant for amount of available moves. After changing from 100 to 300 and from shortint to longint got AC. An example test, where white have 288 available moves: 5 5 5 5 5 5 5 5 5 0 0 0 0 0 0 5 5 0 0 0 0 0 0 5 5 0 0 0 0 0 0 5 5 0 0 0 0 0 0 5 5 0 0 0 0 0 0 5 5 0 0 0 0 0 0 5 5 5 5 5 5 5 5 5 1 White a1-b2 Result: "Draw" and table output. Edited by author 11.01.2016 03:55 |
| What is test case# 2 ? please help me . | draak_krijger | 1941. Scary Martian Word | 11 Jan 2016 01:21 | 1 |
|
| warning!C++ cin.eof() may case WA | eenh3431 | 1001. Reverse Root | 10 Jan 2016 22:50 | 3 |
use cin.eof() to judge the end of input and get WA 3; scanf get AC and while(cin >> a) may case Time Out why does cin.eof() produces WA 3 ? You should use while(scanf("%lf", &a)) |
| getting a runtime error (stackoverflow) | Ajinkya | 1001. Reverse Root | 10 Jan 2016 22:48 | 4 |
#include<iostream> #include<math.h> int main() { using namespace std; int i; float r,a[128*64]; unsigned long long n,j,k; for(i=0;i<n;i++) cin>>a[i]; j=n-1; for(k=j;k>=0;k--) { r=sqrt(a[k]); cout<<r<<"\n"; } return 0; } You should try to increase the size of your array and perhaps use a double array over float. > A size of the input stream does not exceed 256 KB Minimum number of chars per number is 2 - "0 ". So you have to receive up to 128 K numbers. Your array is about 8 K numbers. You shouldn't allocate such big arrays on stack. Use dynamic allocation or std::vector. And another note. > unsigned long long n,j,k; > for(i=0;i<n;i++) > cin>>a[i]; How many times will this for iterate? Why? Edited by author 15.12.2015 21:02 It's preferable to use a double precision floating point type over a single float. n is not given in the input data. I recommend to use std::vector to alloc it: vector <double> input; double aux; while(cin>>aux) input.push_back(aux); |
| To admins | Alex Vistyazh [Ivye School] | 1369. Cockroach Race | 10 Jan 2016 04:28 | 1 |
To admins Alex Vistyazh [Ivye School] 10 Jan 2016 04:28 |
| No subject | Felix_Mate | 1902. Neo-Venice | 9 Jan 2016 23:43 | 1 |
Edited by author 10.01.2016 23:58 |
| if you get WA#8 or WA#13 try this test case. | Adham(TUIT) | 1078. Segments | 9 Jan 2016 12:48 | 2 |
input: 7 1 1000 2 500 501 999 3 499 502 800 4 400 503 700 output: 4 6 4 2 1 or 4 7 5 3 1 |