KEYENCE Programming Contest 2021 (AtCoder Beginner Contest 227) B

 

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 200200 points

Problem Statement

There are N people numbered 1 to N.

Person ii guessed the building area of KEYENCE headquarters building to be Si square meters.

The shape of KEYENCE headquarters building is shown below, where aa and bb are some positive integers.
That is, the building area of the building can be represented as 4ab+3a+3b4ab+3a+3b.

Based on just this information, how many of the N people are guaranteed to be wrong in their guesses?

Sketch of KEYENCE headquarters building

Constraints

  • 1≤N≤20
  • 1≤Si​≤1000
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
S1… Sn
​
 

Output

Print the answer.

Sample Input 1

3
10 20 39

Sample Output 1

1

The area would be 1010 square meters if a=1,b=1a=1,b=1, and 39 square meters if a=2,b=3a=2,b=3.

However, no pair of positive integers aa and bb would make the area 20 square meters.

Thus, we can only be sure that Person 2 guessed wrong.

Sample Input 2

5
666 777 888 777 666

Sample Output 2

3

此题只需暴力模拟。

代码:

#include <iostream>
using namespace std;
#define sum 4 * a * b + 3 * a + 3 * b
int main(){
    int n;
    int s[99];
    cin >> n;
    for(int i = 1;i <= n;i++) cin >> s[i];
    int ans = 0;
    for(int i = 1;i <= n;i++){
        bool t = false ;
        for(int a = 1;a <= 1000;a++)
            for(int b = 1;b <= 1000;b++)
                if( sum == s[i]) t = true;
        if(t == false ) ans++;
    }
    cout << ans << endl ;
    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值