A - ABD
Time limit : 2sec / Memory limit : 256MB
Score : 100 points
Problem Statement
Decades have passed since the beginning of AtCoder Beginner Contest.
The contests are labeled as ABC001
, ABC002
, … from the first round, but after the 999-th round ABC999
, a problem occurred: how the future rounds should be labeled?
In the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001
, ABD002
, …, ABD999
.
You are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.
Constraints
- 1≤N≤1998
- N is an integer.
[题目解释]
比赛从第一轮开始被标记为ABC001,ABC002,但是在第999轮ABC999之后,出现了一个问题:未来的比赛应该如何标记?最后,决定从第1000个到第1998个回合的标签:ABD001,ABD002,...,ABD999。问第n场比赛的前三个字母是什么?
[题目解析]
这是一道简单的模拟题,由于题目问的是第n场比赛的前三个字母是什么,并且答案只有ABC和ABD两种,那么我们只需要关心第n场是在1到999之间还是1000到1998之间即可,输出对应答案;
[代码]
/* Name: ABD Author: FZSZ-LinHua Date: 2018 06 10 Exec time: 1ms Memory usage: 258KB Score: 100 Algorithm: Brute-force */ # include "iostream" # include "cstdio" using namespace std; int n; int main(){ scanf("%d",&n); if(n<=999){ printf("ABC"); }else{ printf("ABD"); } return 0; }
原文地址:https://www.cnblogs.com/FJ-LinHua/p/9164825.html