#include #include #include <stdio.h> using namespace std;

int analysis(int x) { int cnt = 0; // 记录超过x的天数 int num; // 每天背的单词数量 while (cin >> num) // 从标准输入读入数据,直到结束标志-1 { if (num == -1) break; // 遇到结束标志,退出循环 if (num > x) cnt++; // 如果当天背单词数量超过x,计数器加1 string word; for (int i = 0; i < num; i++) { cin >> word; // 读入单词 // 可以在这里对单词进行处理,比如存储到容器中 } } return cnt; }

int main() { int x; cin >> x; cout << analysis(x); return 0; }

C++ 编程练习:统计英语单词背诵数量超过指定值的天数

原文地址: https://www.cveoy.top/t/topic/oEyZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录