Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
42272 liusiyu 找出1~N范围内的所有回文数字 C++ Accepted 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; }


Judgement Protocol: