1 solutions
-
0
C :
#include <stdio.h> int a[10], i, x, y, z; int main(void) { for (i = 1; i <= 10; i++) { scanf("%d", &a[i]); if (!a[i]) { x++; } else if (a[i] < 0) { y++; } else { z++; } } printf("%d %d %d\n", x, y, z); return 0; }C++ :
#include<iostream> using namespace std; int main() { int b,a,c,e; a=0; c=0; e=0; for (int i=1;i<=10;i++) { cin>>b; if (b==0) a++; if (b<0) c++; if (b>0) e++; } cout<<a<<" "<<c<<" "<<e<<endl; return 0; }Pascal :
var a,b,c,d,e:longint; begin a:=0; b:=0; c:=0; for d:=1 to 10 do begin read(e); if e=0 then a:=a+1; if e<0 then b:=b+1; if e>0 then c:=c+1; end; writeln(a,' ',b,' ',c); end.Python :
# coding=utf-8 a, x, y, z = input(). split(), 0, 0, 0 for i in range(0, 10) : if not int(a[i]) : x = x + 1 elif int(a[i]) < 0 : y = y + 1 else : z = z + 1 print(x, y, z)
- 1
Information
- ID
- 17766
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By