题目1183:守形数

来源:互联网 发布:java try catch嵌套 编辑:程序博客网 时间:2024/05/16 14:26
#include <iostream>#include <stdio.h>#include <algorithm>#include <math.h>#include <string>#include <string.h>#include <vector>#include <queue>#include <stack>#include <sstream>using namespace std;//1183int main(){    int n,x,y;    //freopen("input.txt","r",stdin);    while(cin>>n){        x=n*n;        y=n;        int l=0;        while(y){            l++;y/=10;        }        int t=1;        while(l--){            t*=10;        }        t=x%t;        if(n==t)    printf("Yes!\n");        else        printf("No!\n");    }    return 0;} /**************************************************************    Problem: 1183    User: cust123    Language: C++    Result: Accepted    Time:10 ms    Memory:1520 kb****************************************************************/

0 0
原创粉丝点击