当前位置:网站首页>[CCF CSP] 201803-1 jump jump
[CCF CSP] 201803-1 jump jump
2022-07-22 04:01:00 【Jenny, Jenny】
Problem description
Question number : | 201803-1 |
The title of the test question : | Take a jump |
The time limit : | 1.0s |
Memory limit : | 256.0MB |
Problem description : | Problem description Recently, , This little game is popular all over the country , Loved by many players . Input format The input contains multiple numbers , Separate... With spaces , Every number is 1,2,0 One of ,1 It means that the jump jumped on the square but didn't jump to the center ,2 It means that this jump jumped on the square and jumped to the center of the square ,0 It means that this jump didn't jump on the box ( The game is over ). Output format Output an integer , Score for this game ( Under the rules of this question ). The sample input 1 1 2 2 2 1 1 2 2 0 Sample output 22 Data size and engagement For all profiling use cases , The number entered does not exceed 30 individual , Guarantee 0 Appears exactly once and is the last number . |
#include<bits/stdc++.h>
using namespace std;
int main() {
int score=0, sum = 0,n=1;
while (n)
{
cin >> n;
if (n == 1) {
score = 0;
sum++;
}
else if(n==2) {
score += 2;
sum += score;
}
}
cout << sum;
return 0;
}
边栏推荐
- 【CCF CSP】201709-1打酱油
- PCIE链路初始化&训练
- [mid 2022 summary] I walk very slowly, but I never retreat
- 2020-2021新技术讲座课程
- 第三章课后习题24-33
- 数据模型子类化参考
- 真人踩过的坑,告诉你避免自动化测试新手常犯的10个错误
- xxl-job源码阅读笔记
- Su Chunyuan, founder of science and technology · CEO of Guanyuan data: making business use is the key to the Bi industry to push down the wall of penetration
- Collation of common tools in commons Lang
猜你喜欢
真人踩过的坑,告诉你避免自动化测试新手常犯的10个错误
从浏览器上传、下载Excel文件到数据库
第三章课后习题24-33
PAM4科普
Lorsque idea crée un dossier, le dossier vide du dossier s'agrandit et se chevauche
Sequences, Time Series and Prediction in Tessorflow quizs on Coursera (一)
Natural language Processing in tensorflow quizs on Coursera
Field injection is not recommended怎么处理
PWN的学习
3.2队列
随机推荐
Baidu world 2022, see you tomorrow!
静态方法与实例方法的区别
企业进行知识管理有哪些好处?
PAM4科普
Multiplier technology cloud management and control platform adapts to Alibaba cloud polardb, and jointly promotes the prosperity of cloud native database ecosystem
System
Serial Vector Format(SVF)文件格式
[CCF CSP] 201312-1 the number with the most occurrences
JS高级 之 ES5 实现继承
shell运算符-数学运算,关系运算,字符串运算,文件检测运算
[39题] 牛客深度学习专项题
Sequences, Time Series and Prediction in Tessorflow quizs on Coursera (二)
2020-2021新技术讲座课程
SATA协议OOB随笔
Athlete and coach case code
Li Shuo, vice president of Baidu: AI can go deep into the scene and create real value. From sensors to large screens, it is just the beginning of digitalization
gadget之usb_function
gadget之composite
3.1栈
Monai label -- use AI to accelerate your segmentation annotation