1 条题解
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ int n,a[1000],i,c1=0,c2=0,c3=0; cin>>n; for(i = 1;i <= n;i++){ cin>>a[i]; if(a[i] == 90) c1++; else if(a[i] < 90) c2++; else if(a[i] > 90) c3++; } cout<<c1<<" "<<c2<<" "<<c3; return 0; }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int [] b=new int[a]; int sum=0,num=0,count=0; for(int i=0;i<a;i++){ b[i]=sc.nextInt(); if(b[i]<90){ sum++; }if(b[i]==90){ num++; }if(b[i]>90){ count++; } }System.out.println(num+" "+sum+" "+count); } }
Python :
n=int(input()) s1=list(map(int,input().split())) zj=[item for item in s1 if item==90] dj=[item for item in s1 if item>90] rj=[item for item in s1 if item<90] print(len(zj),len(rj),len(dj))
- 1
信息
- ID
- 2679
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者