| Show all threads     Hide all threads     Show all messages     Hide all messages | 
| TO ADMINS | andreyDagger`~ | 1000. A+B Problem | 26 Jan 2025 15:07 | 3   | 
Why is this code gives Runtime Error? I think it's not a problem to allow participants use exceptions, as long as they are not throwing it out of main:   #include <iostream>   int main() {     int a, b;     std::cin >> a >> b;     try {         throw std::exception();     } catch (...) {}     std::cout << a + b << "\n"; } For some old C++ compilers it was impossible to determine whether the exception is caught or not. At the same time there are very little practical use cases for using exceptions in C++ solutions. So, there was no reason in trying to fix the issue.   I don't know if the modern compilers already made it possible to determine. But even if they do I would still keep this feature disallowed because it takes reasonable effort to verify that a not so popular feature works properly on each new version of each of the C++ compilers. Thanks for clarification. I was solving problem 1074 and thought it is a good idea to throw exception if parsing is failed somewhere in the depth of recursion. But yeah, this is the only problem from all of the archive where I wanted to use exceptions  | 
| solved  | Jakub Minarik | 1000. A+B Problem | 28 Mar 2024 16:13 | 1   | 
solved Jakub Minarik 28 Mar 2024 16:13 already done. for someone who doesn't know how to do it:   a,b = input().split() print(int(a)+int(b)) a = int(1) b = int(5)   Edited by author 28.03.2024 16:23  | 
| No subject | Ivan | 1000. A+B Problem | 17 Oct 2022 17:42 | 1   | 
короче сам голову ломал, там переменные в 1 строку вводить надо может кто то также ошибся  | 
| C# Что тут не так? Уже 7 раз переделывал. Все равно пишет: "Wrong Answer". | andvpmb | 1000. A+B Problem | 12 Jan 2022 12:25 | 2   | 
using System;   namespace Timus {     class Program     {         static void Main()         {             string nums = Console.ReadLine();             int a = Convert.ToInt32(nums.Substring(0, 1));             int b = Convert.ToInt32(nums.Substring(2, 1));             int c = a + b;             Console.WriteLine(c);         }     } }  | 
| No way | andreyDagger | 1000. A+B Problem | 11 Dec 2021 16:04 | 1   | 
No way andreyDagger 11 Dec 2021 16:04 No way, this become harder than 1293. Eniya. We did it, guys!!!  | 
| How to get 0.015 solution on python?  | Egor Sibriaev | 1000. A+B Problem | 11 Dec 2021 15:11 | 1   | 
 | 
| Python 3 . So strange . Runtime error (Russian plz) | Kozo Hoshino | 1000. A+B Problem | 31 Mar 2021 18:15 | 4   | 
a = float(input("a:")) b = float(input("b:")) print(a+b)   Edited by author 02.11.2019 14:57   Edited by author 02.11.2019 14:59 a = int(input()) b = int(input()) print(a+b)   Runtime error . what ? You are trying to get 2 inputs but there is only one  | 
| Что не так (python)? | Roma | 1000. A+B Problem | 12 Jan 2021 09:33 | 2   | 
a, b = int(input()), int(input()) print(a + b) Очевидно, что там один ввод, а ты два раза спрашиваешь отдельно для а и b.  | 
| This problem is very hard(easy),I cannot(can) solve it! | Accepted | 1000. A+B Problem | 1 Jan 2021 04:46 | 2   | 
we can use the netflow algorithm(+ operator) to solve this problem. #include <cstdio> #include <cstring> #include <algorithm> #define MAXN 5 using namespace std; const int INF=1<<30; int n,m,flow[MAXN][MAXN],pre[MAXN],cur[MAXN],gap[MAXN],d[MAXN],g[MAXN],l[MAXN][MAXN]; int Maxflow_Isap(int s,int t,int n) {     memset(d,-1,sizeof(d));     memset(pre,-1,sizeof(pre));     memset(gap,0,sizeof(gap));     gap[s]=n;     int u=pre[s]=s,v,maxflow=0;     while (d[s]<n) {       v=n+1;       for (int i=cur[u];i<=g[u];i++)         if (flow[u][l[u][i]] && d[u]==d[l[u][i]]+1) {           v=l[u][i];cur[u]=i;break;         }       if (v<=n) {         pre[v]=u;u=v;         if (v==t) {           int dflow=INF;u=s;           for (int i=v;i!=s;i=pre[i]) dflow=min(dflow,flow[pre[i]][i]);           maxflow+=dflow;           for (int i=v;i!=s;i=pre[i]) {             flow[pre[i]][i]-=dflow;             flow[i][pre[i]]+=dflow;           }         }       }       else{         int mindist=n;         for (int i=1;i<=g[u];i++)           if (flow[u][l[u][i]]) mindist=min(mindist,d[l[u][i]]);         if (!--gap[d[u]]) return maxflow;         gap[d[u]=mindist+1]++;cur[u]=1;         u=pre[u];       }     }     return maxflow; } void setsize(int x,int y,int c) {     flow[x][y]=c;     l[x][++g[x]]=y;     l[y][++g[y]]=x; } int main() {     scanf("%d%d",&n,&m);     setsize(1,2,n);     setsize(2,4,n);     setsize(1,3,m);     setsize(3,4,m);     printf("%d\n",Maxflow_Isap(1,4,4));     return 0; } Thank you for this code, I'm curious to know, is there any shorter form of this i can use for a contest?  | 
| Почему не получается? C# | Юрий | 1000. A+B Problem | 17 Dec 2020 13:22 | 5   | 
Пишу на C#: using System;   namespace Timus_Console {     class Program     {         static void Main(string[] args)         {             int ans1 = Convert.ToInt32(Console.ReadLine());             int ans2 = Convert.ToInt32(Console.ReadLine());             int st = ans1 + ans2;             Console.WriteLine(st);             Console.ReadKey();         }     } }   Edited by author 25.03.2016 11:48 Не могу не чем помочь. Пишу на Питоне и Паскале Please read: http://acm.timus.ru/help.aspx?topic=judge&locale=en"The program must print only the data that is required by the problem statement. The program must not print any prompts (“Enter N:”). The program must not wait for pressing a key at the end of execution"  Also you should make your program passing task sample. Both numbers are on the same line in the sample. тоже не пойму в чем прикол, VS studio все ок работает, а на сайте при отправке ошибка компиляции. Какой синтаксис он использует при проверке Пишу на C#:   using System; /*Вычислите a+b (1 5)  1000. A+B Problem */ namespace A_B_Problem {     public class Program     {         static void Main(string[] args)         { int a = 5; int b = 1; int c = a + b;             Console.WriteLine(c);             Console.ReadLine();         }     } } в конце программы не нужен пустой Console.ReadLine() или .ReadKey(), только вывод ответа  | 
| помогите пожалуйста | andrew354 | 1000. A+B Problem | 6 Jul 2020 14:00 | 2   | 
a = int(input()) b = int(input()) print(a+b) вы считываете данные из двух строк. А надо из одной. Т.е. первые две строки надо заменить на одну строку "a, b = map(int, input().split())".  | 
| JavaEntryPointWrapper.java:10: error: cannot access Oppa  | Kairat | 1000. A+B Problem | 28 Jan 2020 18:35 | 3   | 
JavaEntryPointWrapper.java:10: error: cannot access Oppa             Oppa.main(args);             ^   bad source file: .\Oppa.java     file does not contain class Oppa     Please remove or make sure it appears in the correct subdirectory of the sourcepath. 1 error Выходит такая ошибка, почему? У меня аналогичная ошибка. В том, что файл содержит один публичный класс, совпадающий с именем файла уверен на 100%. Причем проверил на файлах, которые отправлял ранее и удачно решенные, тоже самое. Даже решение из руководства не проходит...  | 
| So easy / phyton 3 solution | SMMaster | 1000. A+B Problem | 15 Dec 2019 16:38 | 1   | 
a, b =map(int, input().split()) print(a + b)  | 
| 1000 | Саша | 1000. A+B Problem | 7 Dec 2019 20:08 | 1   | 
1000 Саша 7 Dec 2019 20:08  | 
| Python 3, wrong answer although it works in Jupyter, why? | Liza | 1000. A+B Problem | 2 Nov 2019 15:04 | 3   | 
a,b=input('Введите числа через пробел: ').split(" ") a=int(a) b=int(b) print(a+b)   test 1, wrong answer :( Got it. The text in Russian was not a good idea.   just this:   a,b=input().split() a=int(a) b=int(b) print(a+b)   accepted! Hello Lisa . It and my error ) a = float(input(" ")) b = float(input(" ")) print(a+b) Runtime error Rus : Привет , у меня такая же ошибка . Выдает Runtime error  | 
| How???? | vtalgo19_NChernyshev☭ | 1000. A+B Problem | 12 Aug 2019 10:28 | 2   | 
How???? vtalgo19_NChernyshev☭ 8 Jun 2019 03:15 Im struggling with it for few days, but absolutely have no idea how to do it! Any hints?? What specifically are you having a problem with? For example, are you trying to figure out how to write your code so that it reads and saves the input?  | 
| ъеъ | vtalgo19_NChernyshev☭ | 1000. A+B Problem | 8 Jun 2019 03:21 | 1   | 
ъеъ vtalgo19_NChernyshev☭ 8 Jun 2019 03:21  | 
| Почему ваш компилятор не видит директиву "stdafx.h" | Ilya | 1000. A+B Problem | 5 Jun 2019 15:50 | 2   | 
#include "stdafx.h" #include <iostream>       int main() {     int a;     int b;     int c;     scanf_s("%d%d\n", &a, &b);     c = a + b;     printf("%d\n", c);     return 0; } Зачем тебе эти директивы вообще? Нужна только айострим. И пишется так: <stdafx.р>  | 
| Всё оч просто.с++ | Kostya | 1000. A+B Problem | 5 Jun 2019 15:47 | 1   | 
#include <iostream> using namespace std; int main() {  long long a, b;  cin >> a >> b;  cout << a+b; }  | 
| В чем проблема такого решения на ruby? | ypavlov | 1000. A+B Problem | 22 May 2019 11:41 | 1   | 
puts gets.split(' ').sum { |s| s.to_i }   а вот так ок: puts gets.split(' ').map { |s| s.to_i }.inject(0) {|sum,x| sum + x }   что не так с с sum? Edited by author 22.05.2019 11:43   Edited by author 29.05.2019 02:44  |