Liamcoder


私信TA

用户名:18817572995

访问量:9574

签 名:

Where there is a will, there is a way.

等  级
排  名 1861
经  验 2486
参赛次数 2
文章发表 11
年  龄 0
在职情况 学生
学  校 上海师范大学
专  业 计算机科学与技术

  自我简介:

屌丝程序狗

参考代码:

#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int count = 0;
double arg = 0;
int x[20];
for(int i=0; i<20; i++){
cin >> x[i];
if(x[i]<0) count++;
if(x[i]>0) arg += x[i];
}
arg = arg / (20-count);
cout << count << endl;
cout << setiosflags(ios::fixed) << setprecision(2) << arg;
return 0;
}


 

0.0分

5 人评分

  评论区