求助水题(QAQ我太蒻了)
  • 板块学术版
  • 楼主2011Andy
  • 当前回复7
  • 已保存回复7
  • 发布时间2023/4/17 13:45
  • 上次更新2023/10/23 18:13:12
查看原帖
求助水题(QAQ我太蒻了)
660871
2011Andy楼主2023/4/17 13:45

【1-6】特殊数字判断

题目描述

Karl 有 nn 个正整数 a1,...,ana_1,...,a_n,请你依次判断每一个数是否满足如下要求之一:

  • 是三位数。
  • 个位为 33。
  • 是 77 的倍数。

请你对每一个数进行判断。

输入格式

第一行一个正整数 nn。

第二行 nn 个正整数 a1,...,ana_1,...,a_n。

输出格式

nn 行每行一个字符串表示结果,如果该数满足要求输出 Yes,否则输出 No。

样例 #1

样例输入 #1

3
123 24 3

样例输出 #1

Yes
No
Yes

提示

  • 对于 100%100\% 数据:1≤n≤1031 \leq n \leq 10^3,1≤ai≤1041 \leq a_i \leq 10^4。

mycode:mycode:

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	for(int i = 1 ; i <= n ; i++){
		int x;
		cin >> x;
		if((x % 1000 >= 100 && x % 1000 <= 999) && x % 10 != 3 && x % 7 != 0) cout << "Yes" <<1<< endl;
		else if(!(x % 1000 >= 100 && x % 1000 <= 999) && x % 10 == 3 && x % 7 != 0) cout << "Yes" <<2<< endl;
		else if(!(x % 1000 >= 100 && x % 1000 <= 999) && x % 10 != 3 && x % 7 == 0) cout << "Yes" <<3<< endl;
		else cout << "No" << endl;
	}
	return 0;
}
2023/4/17 13:45
加载中...