0
点赞
收藏
分享

微信扫一扫

CCF 2019-12

兮城 2023-03-13 阅读 52

一:

试题编号:

2019-12-1

试题名称:

报数

时间限制:

1.0s

内存限制:

256.0MB

问题描述:



CCF 2019-12_i++





CCF 2019-12_ios_02



#include <iostream>
using namespace std;
int main() {

//n此报数
int n;
//记录每个人的跳过次数
int num[4] = { 0 };
//报数器
int count = 1;

//输入过程
cin >> n;

//报数过程
for (int i = 0; i < n; i++ ,count++) {
int temp = count;
//是否为7的倍数
if (count % 7 == 0) {
num[(count-1) % 4]++;
i--;
}
else {
//判断count中是否有7
while (temp > 0) {
if (temp % 10 == 7)break;
temp = temp / 10;
}
if (temp > 0){
num[(count - 1) % 4]++;
i--;
}
}
}

//输出过程
for (int i = 0; i < 4; i++)
cout << num[i] << endl;

}


二:

试题编号:

2019-12-2

试题名称:

回收站选址

时间限制:

1.0s

内存限制:

256.0MB

问题描述:

CCF 2019-12_ci_03

CCF 2019-12_ci_04


CCF 2019-12_ci_05

#include <iostream>
using namespace std;

//垃圾堆数据结构体
typedef struct Node {
int x, y;
int up = 0, down = 0, left = 0, right = 0;
int score = 0;
}Node;

int main() {
//垃圾堆个数n
int n;
//垃圾堆结构体数组
Node node[1001];
//该得分的数量
int s[5] = { 0 };

//输入过程
cin >> n;
for (int i = 0; i < n; i++) {
cin >> node[i].x >> node[i].y;
}


for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
//查看每个垃圾堆的上下左右,
if (node[j].y == node[i].y + 1 && node[j].x == node[i].x)
node[i].up = 1;
if (node[j].y == node[i].y - 1 && node[j].x == node[i].x)
node[i].down = 1;
if (node[j].x == node[i].x - 1 && node[j].y == node[i].y)
node[i].left = 1;
if (node[j].x == node[i].x + 1 && node[j].y == node[i].y)
node[i].right = 1;
//查看每个垃圾堆的斜方向,
if (node[j].x == node[i].x + 1 && node[j].y == node[i].y + 1)
node[i].score++;
if (node[j].x == node[i].x - 1 && node[j].y == node[i].y + 1)
node[i].score++;
if (node[j].x == node[i].x - 1 && node[j].y == node[i].y - 1)
node[i].score++;
if (node[j].x == node[i].x + 1 && node[j].y == node[i].y - 1)
node[i].score++;
}

}

//若上下左右都为1,则记录其得分
for (int i = 0; i < n; i++) {
if (node[i].up == 1 && node[i].down == 1 && node[i].left == 1 && node[i].right == 1) {
if (node[i].score == 0)
s[0]++;
if (node[i].score == 1)
s[1]++;
if (node[i].score == 2)
s[2]++;
if (node[i].score == 3)
s[3]++;
if (node[i].score == 4)
s[4]++;
}
}
//输出
for (int i = 0; i < 5; i++) {
cout << s[i] << endl;
}
return 0;
}


三:

试题编号:

2019-12-3

试题名称:

化学方程式

时间限制:

1.0s

内存限制:

256.0MB

问题描述:

未解答



四:

试题编号:

2019-12-4

试题名称:

区块链

时间限制:

1.0s

内存限制:

256.0MB

问题描述:

未解答



五:

试题编号:

2019-12-5

试题名称:

魔数

时间限制:

1.0s

内存限制:

256.0MB

问题描述:

未解答


举报

相关推荐

0 条评论