1 solutions
-
0
C :
#include <stdio.h> int main(){ //freopen("test.in", "r", stdin); //freopen("test.out", "w", stdout); int N; scanf("%d", &N); for(int i = 1; i <= N; i ++){ int a, b; scanf("%d %d", &a, &b); printf("Case #%d: %d\n", i, a+b); } return 0; }C++ :
#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> int main() { int N,a,b,sum,i=1; scanf("%d",&N); while(N--) { scanf("%d%d",&a,&b); sum=a+b; printf("Case #%d: %d\n",i,sum); i++; } }Pascal :
var a,b,i,n:integer;s:array[1..100]of integer; begin readln(n); for i:=1 to n do begin readln(a,b);s[i]:=a+b;end; for i:=1 to n do writeln('Case #',i,': ',s[i]); end.Java :
import java.util.Scanner; public class Main{ private static Scanner s = new Scanner(System.in) ; public static void main(String[] args) { int N = s.nextInt() ; if(N>=0&&N <= 5){ for (int i = 0; i < N; i++) { int a = s.nextInt() ; int b = s.nextInt() ; if(0<=a&&a<=1000&&b>=0&&b<=1000){ System.out.println("Case #"+(i+1)+": "+(a+b)+"") ; } } } } }Python :
a = input() for i in range(0,a): a,b=map(int,raw_input().split()) print "Case #%d: %d"%(i+1,a+b)
- 1
Information
- ID
- 19614
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By