Comments (3)
感谢提出质疑
但是我还是有点儿疑问
关于第一个问题:我在分析中的第三点这样阐述 [ 3.注意,平均分是四舍五入的,所以需要按照+0.5后取整,保证是四舍五入的(听说不四舍五入也能通过…)]
因为平均成绩本身按照四舍五入来说才是正确的,题目中如果真的无需四舍五入的话应该具体说明【For the sake of simplicity, xxxxxx】这样的话,否则逻辑上是不通的
关于第二个问题:题目中[each contains a student ID which is a string of 6 digits] 题目中这句话不是表明是6位数字的意思么
from pat.
其实第一个问题,题目中也没细说,对于是否需要四舍五入,产生疑问是肯定的(不管是否四舍五入也都可以通过...),而第二个问题,是我审题不清(好尴尬呀~),谢谢指正
from pat.
#include<iostream>
#include<vector>
using namespace::std;
int main(){
int N; cin>>N;
vector<int> v(N);
for(int i=0;i<N;i++){
cin>>v[i];
}
// vector<int> v={13,1,2,3,4,5,6,7,8,9,10,20,16,18};
// vector<int> v={8,1,2,4,5,6,7,9,16};
int A[5]={0}; bool test[5]={false};
int sign=-1;
int cout3=0;
int mx=-1000;
for(auto x:v){
if(x%5==0&x%2==0){
A[0]+=x;
test[0]=true;
};
if(x%5==1){
sign *= (-1);
A[1]+=(x * sign);
test[1]=true;
}
if(x%5==2){
A[2]++;
test[2]=true;
}
if(x%5==3){
A[3]+=x;
cout3++;
test[3]=true;
// cout<<x<<" ";
}
if(x%5==4){
if(x>A[4]){
A[4]=x;
test[4]=true;
};
}
}
test[0]?cout<<A[0]<<" ":cout<<"N"<<" ";
test[1]?cout<<A[1]<<" ":cout<<"N"<<" ";
test[2]?cout<<A[2]<<" ":cout<<"N"<<" ";
test[3]?printf("%.1f ",float(A[3])/cout3):printf("%s ","N");
test[2]?cout<<A[4]:cout<<"N";
return 0;
}
你可以用这个答案,但是需要找到为啥有一点过不去。。。。。
from pat.
Related Issues (20)
- 1018 不必模拟整个过程,need记录权重最小值即可
- [Advanced/C++/1135] Suggestion
- [Advanced/C++/1095] bug report
- [Advanced/C++/1159] Suggestion
- [Advanced/C++/1103]代码执行结果与样本输出结果不同,但是能够AC
- [Basic level Java] 1015 德才论
- [Basic level Java] 1017. A除以B (20) 全部运行超时
- PAT (Basic Level)1008 数组元素循环右移问题 更为简单做法
- 【改写原解法】PAT【甲级】1060 Are They Equal (25 分)
- 【甲级1014另解】1014 Waiting in Line
- PAT BasicLevel 1032
- Lanqiao
- 乙级1056 组合数的和(C++)更优解
- [Advence/c++/1026]测试样例改变,导致第一个测试点过不去
- 提供乙级1008 python版本的PythonIC风格代码
- Pat乙级1008 数组元素循环右移问题(简洁到极致的写法)
- PAT-B 1018. 锤子剪刀布 (20)(最简洁巧妙的写法)
- PAT甲级1025 学生id定义 HOT 1
- 【PAT Advanced Level 1026 Table Tennis】关于同一秒钟多个桌子空闲,分配多个客人的情况
- 1069答案只能得十分呀怎么办 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pat.