提交时间:2026-05-26 16:19:54

运行 ID: 89294

#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; }