Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
46467 | jiabokai | 数位和为偶数的数 | C++ | Accepted | 0 MS | 240 KB | 272 | 2024-05-04 09:17:17 |
#include<bits/stdc++.h> using namespace std; int digital_sum(int n){ int sum=0; while(n){ sum+=(n%10); n/=10; } return sum; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ if(digital_sum(i)%2==0){ cout<<i<<" "; } } return 0; }