解题思路:
注意事项:
参考代码:
#include<iostream> #include <bits/stdc++.h> using namespace std; int main() { int score; int n,count1=0,count2=0; cin>>n; for(int i=0;i<n;i++) { cin>>score; if(score>=60)count1++; if(score>=85)count2++; } //cout<<count1<<endl<<count2<<endl; double a=round(count1*100.0/n); double b=round(count2*100.0/n); cout<<a<<"%"<<endl<<b<<"%"<<endl; return 0; }
0.0分
0 人评分