1183 Number of guard shapes

Source: Internet
Author: User
Tags sprintf

/* If the positive integer n is the tail of its square number, then n is the guard number, also called the isomorphism number. For example: 6 is the tail of its square number 36, 76 is the tail of its square number 5776, 6 and 76 are the number of the guard. These are also: 6^=3625^2=62576^2=5776376^= 141376625^=390625 Programming Tips: 1. The traditional use of a count variable count, and then the loop body has been number/10,count count, the last count is the number of digits 2. Directly with the log function, the number of bits count= (int) log10 ( num) +13. With the sprintf and strlen functions, sprintf (str, "%d", num), Count=strlen (str), this direct length efficiency is certainly much lower, but directly with the library function does not need to implement, STR is also valuable if string processing is required */# include <stdio.h>int quar (int x, int n) {int sum = 1;for (int i = 0; i < n; i++) {sum = s Um * x;} return sum;} int main (void) {int i,n,num,pow,count;scanf ("%d", &n); GetChar ();    Absorbs the carriage return character. for (i = 0; i < n; i++) {count = 0;scanf ("%d", &num); GetChar ();    Absorbs the carriage return character. int temp = NUM;POW = num * num;printf ("%d", pow), while (temp) {temp = temp/10;count++;} if (Pow% (quar, count)) = = num) printf ("yes!\n"); elseprintf ("no!\n");} return 0;}

1183 number of guards

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.