当前位置:网站首页>【暑期每日一题】洛谷 P6336 [COCI2007-2008#2] BIJELE
【暑期每日一题】洛谷 P6336 [COCI2007-2008#2] BIJELE
2022-07-29 07:08:00 【AC_Dragon】
题目链接:P6336 [COCI2007-2008#2] BIJELE - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
题目背景
Mirko 在阁楼发现了一套残缺的棋子。
题目描述
对于一套正确的棋子,应该包含:
- 一个国王;
- 一个皇后;
- 两个车;
- 两个象;
- 两个马;
- 八个兵。
现在给出这套残缺的棋子中每种棋子分别有多少个,请你求出需要如何添加或删除棋子来凑出完整的棋盘。
输入格式
输入一行六个数,依次表示国王,皇后,车,象,马,兵的数量。这些数字都在 $0\sim 10$ 之间(包含端点)。
输出格式
输出一行六个数,依次表示国王,皇后,车,象,马,兵需要添加或删除的数量。用正数来表示添加,用负数来表示删除。
样例 #1
样例输入 #1
0 1 2 2 2 7
样例输出 #1
1 0 0 0 0 1
样例 #2
样例输入 #2
2 1 2 1 2 1
样例输出 #2
-1 0 0 1 0 7
提示
说明
题目译自 COCI2007-2008 CONTEST #2 T1 BIJELE。
AC code:
#include<iostream>
#include<algorithm>
using namespace std;
// 1 1 2 2 2 8
int main()
{
int a[6];
for(auto &i:a) // 注意这里必须要加 &!!!
cin>>i;
cout<<1-a[0]<<" "<<1-a[1]<<" "<<2-a[2]<<" "<<2-a[3]<<" "<<2-a[4]<<" "<<8-a[5];
return 0;
}
边栏推荐
- Scala 高阶(九):Scala中的模式匹配
- Using C language to skillfully realize the chess game -- Sanzi chess
- 彻底搞懂kubernetes调度框架与插件
- zip gzip tar压缩进阶版
- leetcode力扣经典问题——4.寻找两个正序数组的中位数
- Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
- Excel file reading and writing (creation and parsing)
- NPM install reports an error NPM err could not resolve dependency NPM err peer
- Summary of OCR optical character recognition methods
- 1 - background project construction
猜你喜欢
How to establish EDI connection with Scania in Scania?
同步/异步、阻塞/非阻塞 与 IO
Scala 高阶(十):Scala中的异常处理
MySQL uses the client and select methods to view the summary of blob type fields
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
Paper reading (62):pointer networks
使用自定义注解校验list的大小
【WPF】通过动态/静态资源实现语言切换
【OpenGL】着色器(Shader)的使用
Operator3 - design an operator
随机推荐
能在SQL 语句中 指定 内存参数吗?
js第四天流程控制(if语句和switch语句)
Summer summary (II)
Scala 高阶(十):Scala中的异常处理
女研究生做“思维导图”与男友吵架!网友:吵架届的“内卷之王”....
[OpenGL] use of shaders
CMOS芯片制造全工艺流程
MySQL 使用客户端以及SELECT 方式查看 BLOB 类型字段内容总结
Kubernetes (V) -- deploy kubernetes dashboard
MySQL uses the client and select methods to view the summary of blob type fields
彻底搞懂kubernetes调度框架与插件
我,28岁,测试员,10月无情被辞:想给还在学测试 的人提个醒......
JS break and continue and return keywords
Description of rollingfileappender attribute in logback
Gin parameter validation
Vite3.0 has been released, can you still roll it (list of new features)
BeanUtils.setProperty()
使用自定义注解校验list的大小
LevelFilter简介说明
用户列表 圆形头像并跟随小板块