#include "iostream"\nusing namespace std;\n\nint main() {\n int x, n;\n cin >> x >> n;\n \n int totalDistance = 0;\n for (int i = 0; i < n; i++) {\n if (x == 6 || x == 7) { // 周末休息\n continue;\n }\n \n if (i % 2 == 0) { // 上午游泳\n totalDistance += 150;\n } else { // 下午游泳\n totalDistance += 100;\n }\n \n x = (x + 1) % 7; // 更新星期几\n if (x == 0) {\n x = 7;\n }\n }\n \n cout << totalDistance << endl;\n \n return 0;\n}

小鱼游泳距离计算 - C++代码实现

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

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