数学 SCU 4436 Easy Math

 

题目传送门

 1 /*  2  数学题:当有一个数开根号后是无理数,则No  3 */  4 #include <cstdio>  5 #include <algorithm>  6 #include <cstring>  7 #include <cmath>  8 #include <vector>  9 #include <iostream> 10 #include <string> 11 #include <map> 12 #include <set> 13 using namespace std; 14 15 typedef long long ll; 16 const int MAXN = 1e5 + 10; 17 const int INF = 0x3f3f3f3f; 18 19 bool ok(int x) 20 { 21 int y = sqrt (x); 22 if (y * y == x) return true; 23 else return false; 24 } 25 26 int main(void) //SCU 4436 Easy Math 27 { 28 // freopen ("A.in", "r", stdin); 29 30 int n; 31 while (scanf ("%d", &n) == 1) 32  { 33 bool flag = true; 34 for (int i=1; i<=n; ++i) 35  { 36 int x; scanf ("%d", &x); 37 if (!ok (x)) flag = false; 38  } 39 40 if (flag) puts ("Yes"); 41 else puts ("No"); 42  } 43 44 return 0; 45 }

 

你可能感兴趣的:(Math)