题解 | #四位数#

四位数

https://ac.nowcoder.com/acm/problem/22194

#include <bits/stdc++.h> using namespace std;

bool func(int n){ int a,b,c,d; a = n/1000; b = n/100%10; c= n/10%10; d = n%10; if((a10+b+c10+d)(a10+b+c*10+d)==n) return true; return false;

}

int main() { int n; cin >> n; for(int i=1000;i<=n;i++){ if(func(i)) cout << i << endl; } }

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务