高质量题解|皓仔和水煮蛋
2026-03-15 21:01:18
发布于:北京
0阅读
0回复
0点赞
题目大意
判断煮了 秒的鸡蛋在煮出标准的溏心蛋中分为哪个阶段
考纲知识点
分支结构、输入输出、基础数据类型、变量的定义以及使用
解题思路
想要得到一颗标准的溏心蛋,需要将鸡蛋煮到 分 秒。由于单位为分钟,所以需要转化成秒的单位
- 鸡蛋还未煮到 分 秒,告诉皓仔还需要 秒,故 秒
- 鸡蛋刚好煮到 分 秒,输出"perfect"
- 鸡蛋已经煮到了 分 秒,输出"overcooked"
参考程序
#include <bits/stdc++.h>
using namespace std;
int main(){
int x;
cin >> x;
if(x < 390){
cout << 390 - x;
}else if(x == 390){
cout << "perfect";
}else{
cout << "overcooked";
}
return 0;
}
时间复杂度
这里空空如也








有帮助,赞一个