Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
46677 Xiyou 数位和为偶数的数 C++ 通过 0 MS 244 KB 284 2024-05-05 09:08:16

Tests(1/1):


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


测评信息: