| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 89294 | bnu_fanmeijie | 含k个3的数 | C++ | 通过 | 0 MS | 244 KB | 692 | 2026-05-26 16:19:54 |
#include <iostream> using namespace std; int main() { int m, k; cin >> m >> k; // 第一步:统计 m 中有几个数字 3 int count = 0; // 计数器 int temp = m; // 用临时变量保存m,不破坏原值 while (temp > 0) { int digit = temp % 10; // 取出最后一位 if (digit == 3) { count++; // 是3就计数+1 } temp = temp / 10; // 去掉最后一位 } // 第二步:两个条件同时满足才输出YES if (count == k && m % 19 == 0) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0; }