当前位置:网站首页>【暑期每日一题】洛谷 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;
}边栏推荐
- It's enough for MySQL to have this article (disgusting and crazy typing 37k words, just for Bo Jun's praise!!!)
- js中break与continue和return关键字
- Interface test actual project 03: execute test cases
- 第7节-程序的编译(预处理操作)+链接
- Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
- 2-统一返回类DTO对象
- 3-全局异常处理
- QT连接两个qslite数据库报错QSqlQuery::exec: database not open
- Excel file reading and writing (creation and parsing)
- Paper reading (62):pointer networks
猜你喜欢

WPF nested layout case

How does MySQL convert rows to columns?

亚马逊云助手小程序来啦!

PAT甲级 1146 拓扑顺序

Docker最新超详细教程——Docker创建运行MySQL并挂载

Why does ETL often become ELT or even let?

1-后台项目搭建

Kubernetes (V) -- deploy kubernetes dashboard

JS 鸡生蛋与蛋生鸡问题,Object与Function究竟谁出现的更早?Function算不算Function的实例?

Spark Learning Notes (VII) -- spark core core programming - RDD serialization / dependency / persistence / partition / accumulator / broadcast variables
随机推荐
1 - background project construction
LevelFilter简介说明
路由中的生命周期钩子 - activated与deactivated
MySQL如何把行转换为列?
BeanUtils.setProperty()
logback appender简介说明
Female graduate students do "mind mapping" and quarrel with their boyfriend! Netizen: the "king of infighting" in the quarrel
在线问题反馈模块实战(十七):实现excel模板在线下载功能
Thoroughly understand kubernetes scheduling framework and plug-ins
Redis Basics
Job 7.28 file IO and standard IO
What is the function of fileappender in logback?
【Unity实战100例】Unity万能答题系统之单选多选判断题全部通用
log4j Layout简介说明
Levelfilter introduction
PAT甲级 1150 旅行商问题
Some learning and understanding of vintage analysis
Latest 10 billion quantitative private placement list
Does Flink support sqlserver databases? Get the changes of SQLSERVER database
leetcode力扣经典问题——4.寻找两个正序数组的中位数