SCU 4436 Easy Math 2015 Sichuan province game title

Source: Internet
Author: User
Tags square root

Title Link: http://acm.scu.edu.cn/soj/problem/4436/

Test instructions: give you n integers, to find the square root of the n number and whether it is an integer;

Problem-solving ideas: If the problem of each count to him, the inevitable time, may also be super-precision, so the ingenious method is to determine whether these integers are completely square number, if there is a not, then their square root and certainly not an integer.

AC Code:

#include <cstdio>#include<cmath>#include<cstring>#include<algorithm>#include<iostream>using namespacestd;int  is(intx) {  inty=sqrt (x); if(y*y==x)return 0; return 1;}intMain () {intN; while(SCANF ("%d", &n)! =EOF) {  intf=1;  for(intI=0; i<n;i++)  {   intx; scanf ("%d",&x); if( is(x)) f=0; }  if(f) Puts ("Yes"); ElsePuts"No"); } return 0;}

SCU 4436 Easy Math 2015 Sichuan province game title

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.