|
|
I think the actual solution may like this: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int harry, larry, max;
while(sc.hasNext()){ harry = sc.nextInt(); larry = sc.nextInt();
max = harry + larry;
if(((max % 10) != 0)){
if(((max % 10) <= ((max / 10)))){ max = (10 * ((max / 10))); } else{ max = (10 * ((max / 10) + 1)); } } System.out.println((max - harry) +" "+ (max - larry)); } sc.close(); } } import java.io.*; public class D { public static void main (String args []) throws Exception { BufferedReader d = new BufferedReader(new InputStreamReader(System.in)); String v = d.readLine(); BufferedReader e = new BufferedReader(new InputStreamReader(System.in)); String c = e.readLine(); try { int a = Integer.parseInt(v); int b = Integer.parseInt(c); System.out.print(a+" ");System.out.println(b); System.out.print(b-1+" ");System.out.print(a-1); } catch(Exception e1) {System.out.println("Error translating text to int");} System.out.println(); } } I do smth wrong? Read FAQ how to input numbers Read FAQ how to output answer You used Java, that's what's wrong. Friendoship!!! What is wrong???? #include <math.h> #include <stdio.h> int main(){ int larry, herry,sum; scanf ("%i %i", &larry, &herry); sum=larry+herry; if (sum==11){ printf ("%i %i", herry-1, larry-1); } else printf ("wrong"); return 0; } Because your output only supports the example given in the problem statement. If the sum is NOT 11, your program will fail. Eliminate the "if", and use your first printf. "Каждый из них помнили только" -> "Каждый из них помнил только" |
|
|