Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
46689 sunhuifeng 数位和为偶数的数 C++ 输出格式错误 0 MS 252 KB 262 2024-05-05 09:16:50

Tests(0/1):


#include<iostream> using namespace std; bool pd(int n){ int ans=0; while(n){ ans+=n%10; n/=10; } if(ans%2==0) return 1; else return 0; }int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ if(pd(i)) cout<<i<<" "<<endl; } return 0; }


测评信息: