一、题目
原题链接:https://zoj.pintia.cn/problem-sets/91827364500/problems/91827370501
BaoBao loves number 7 but hates number 4, so he refers to an integer is divisible by 7 but not divisible by 4. For example, 7, 14 and 21 are lucky integers, but 1, 4 and 28 are not.
Today BaoBao has just found an integer .
Input
There are multiple test cases. The first line of the input is an integer (about 100), indicating the number of test cases. For each test case:
The first and only line contains an integer ), indicating the integer in BaoBao's left pocket.
Output
For each test case output one line containing one integer, indicating the value of .
Sample Input
4 1 7 20 28
Sample Output
7 7 21 35
二、AC代码
啥也不说,快乐的水几题。
import java.util.Scanner;
/**
* @author ChangSheng
* @date 2020-03-26
*/
public class P4106_AC_Lucky_7_in_the_Pocket {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int i = 0; i < T; i++) {
int n = sc.nextInt();
// m最大取值为 105
for (int j = n; j <= 105; j++) {
if (j % 7 == 0 && j % 4 != 0) {
System.out.println(j);
break;
}
}
}
}
}