当前位置:网站首页>【暑期每日一题】洛谷 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中的模式匹配
- 【Unity实战100例】Unity万能答题系统之单选多选判断题全部通用
- Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
- js第四天流程控制(if语句和switch语句)
- What is the function of fileappender in logback?
- WPF simple login page completion case
- Vite3.0 has been released, can you still roll it (list of new features)
- Why does ETL often become ELT or even let?
- JS break and continue and return keywords
- 树莓派的启动流程
猜你喜欢

Vite3.0 has been released, can you still roll it (list of new features)

1 - background project construction

3-global exception handling

Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software

Error 1045 (28000) access denied for user 'root' @ 'localhost' solution

2-unified return class dto object

用户列表 圆形头像并跟随小板块

QT basic day 2 (2) QT basic components: button class, layout class, output class, input class, container and other individual examples

Nodejs installation tutorial

Spingboot integrates the quartz framework to realize dynamic scheduled tasks (support real-time addition, deletion, modification and query tasks)
随机推荐
Gin routing, parameters, output
Why does ETL often become ELT or even let?
5-integrate swagger2
Full process flow of CMOS chip manufacturing
20-40k | mecarmand 3D vision algorithm / software / Product Manager Recruitment
CMOS芯片制造全工艺流程
在线问题反馈模块实战(十七):实现excel模板在线下载功能
log4j Layout简介说明
Gin parameter validation
LevelFilter简介说明
2-统一返回类DTO对象
我想问一下,我flink作业是以upsert-kafka的方式写入数据的,但是我在mysql里面去更
Use vscode to configure Mysql to realize connection, query, and other functions
2-unified return class dto object
Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
Unity sends a post request to the golang server for parsing and returning
vue-router路由缓存
Female graduate students do "mind mapping" and quarrel with their boyfriend! Netizen: the "king of infighting" in the quarrel
作业7.28 文件IO与标准IO
Ethernet interface introduction