牛客网PAT练习场-数字分类
2024-10-09 11:29:24
签到题 地址:https://www.nowcoder.com/pat/6/problem/4078
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int A[]={};//存分类数据
int a[]={};//标记是否有数据个数
int t;
int flag=;//A3的标记变量
int num=;//A4的统计变量
scanf("%d",&t);
//IF处理操作
for(int i=;i<t;i++){
int temp;
scanf("%d",&temp);
if((temp%==)&&(temp%==)){
a[]=;
A[]+=temp;
}
if(temp%==){
a[]=;
if(flag==){
A[]+=temp;
flag=;
}else{
A[]-=temp;
flag=;
}
}
if(temp%==){
a[]=;
A[]++;}
if(temp%==){
a[]=;
A[]+=temp;
num++;
}
if(temp%==){
a[]=;
A[]=A[]>temp?A[]:temp;
}
}
//格式输出
for(int i=;i<;i++){
if(a[i]){
if(i==){
printf("%.1lf",A[i]*1.0/num);
}else{
printf("%d",A[i]);
} }else{
printf("N");
}
if(i!=)printf(" ");
}
return ;
}
最新文章
- [No000016]为什么假期计划总是做不到?
- webpack入坑之旅(三)webpack.config入门
- 剑指offer--面试题15
- 例说C#深拷贝与浅拷贝
- 【转】(DT系列一)DTS结构及其编译方法----不错
- Qt多国语言QT_TR_NOOP和QT_TRANSLATE_NOOP
- 2015第10周五CSS—2
- EALayout 实践
- 我们的代码为什么要压缩成7z?
- ORACLE 触发器 基础
- 如何为Windows XP / Windows7-32bit / Windows7-64bit安装capicom.dll
- 如何使用postman传数组数据
- Python图片裁剪
- IdentityServer4-主题
- java三大工厂结果总览
- Java构建指定大小文件
- 【java】自定义异常类
- Spring学习笔记之Container overview
- Django中更新多个对象数据与删除对象的方法
- Java虚拟机19:再谈四种引用状态
热门文章
- 页面上怎么使用svg
- 美团Leaf——全局序列生成器
- PHP date_modify() 函数
- luogu P5826 【模板】子序列自动机 主席树 vector 二分
- luogu P3920 [WC2014]紫荆花之恋
- 区块链钱包开发 - USDT - 三、实战(nodejs版本)
- tensorflow2.0 实现gpu和cpu切换
- Android Studio局部管理器
- 基于深度学习的人脸识别系统Win10 环境安装与配置(python+opencv+tensorflow)
- SpringBoot实现发送邮件