Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
80115 sh25_huangse 统计满足条件的4位数 C++ 通过 0 MS 252 KB 665 2026-01-04 15:00:53

Tests(1/1):


#include <iostream> using namespace std; int main() { int n; cin >> n; int count = 0; // 满足条件的数的个数 for (int i = 0; i < n; i++) { int num; cin >> num; // 分离各位数字 int thousand = num / 1000; // 千位 int hundred = (num / 100) % 10; // 百位 int ten = (num / 10) % 10; // 十位 int unit = num % 10; // 个位 // 判断条件:个位 - 千位 - 百位 - 十位 > 0 if (unit - thousand - hundred - ten > 0) { count++; } } cout << count << endl; return 0; }


测评信息: