Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42272 liusiyu 找出1~N范围内的所有回文数字 C++ 通过 1 MS 244 KB 279 2024-02-25 10:13:26

Tests(1/1):


#include<bits/stdc++.h> using namespace std; bool hw(int n){ int h=0; int num=n; while(n){ h=h*10+n%10; n/=10; } if(num==h) return 1; else return 0; } int main() { int n; cin>>n; for(int i=1;i<=n;i++){ if(hw(i)) cout<<i<<endl; } return 0; }


测评信息: