资讯详情

KEYENCE Programming Contest 2021 (AtCoder Beginner Contest 227) B

Time Limit: 2 sec / Memory Limit: 1024 MB

Score :200200points

Problem Statement

There areNpeople numbered1toN.

Personiiguessed the building area of KEYENCE headquarters building to be Si square meters.

The shape of KEYENCE headquarters building is shown below, whereaaandbbare some. That is, the building area of the building can be represented as4ab 3a 3b4ab 3a 3b.

Based on just this information, how many of theNpeople 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 be1010square meters ifa=1,b=1a=1,b=1, and39 square meters ifa=2,b=3a=2,b=3.

However, no pair of positive integersaaandbbwould make the area20square meters.

Thus, we can only be sure that Person2guessed 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; } 

标签: keyence传感器mu

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台