标题
增加 1 行删除 1 行
1【K-1】五一赛•赛后题解1【K-R1】五一赛•赛后题解
正文
增加 20 行删除 20 行
11 行未改动1213141516171819207 行未改动282930313233343536373839404142434445464748495051525354555657585932 行未改动11 行未改动cout<<a+b;return 0;}```## T2 [$\color{red}\text{【K-1】四则运算计算器}$](https://www.luogu.com.cn/problem/U647071?contestId=324578)根据题目要求进行计算和输出对应算式即可。```cpp#include <iostream>using namespace std;7 行未改动if(c==4) cout<<a<<"/"<<b<<"="<<a/b;return 0;}```## T3 [$\color{red}\text{【K-1】罗马数字}$](https://www.luogu.com.cn/problem/U649172?contestId=324578)从表示最大数字的 $M$ 开始逐步向下推即可,每输出一个字母之后将题目给出的数字 $n$ 减去输出字母代表的数字。**注意特判 $4$ 和 $9$ 这两个数字。**```cpp#include <iostream>using namespace std;int main(){int n;cin>>n;if(n==4) {cout<<"IV";return 0;}if(n==9) {cout<<"IX";return 0;}while(n/1000) {cout<<"M";n-=1000;}while(n/500) {cout<<"D";n-=500;}while(n/100) {cout<<"C";n-=100;}while(n/50) {cout<<"L";n-=50;}while(n/10) {cout<<"X";n-=10;}while(n/5) {cout<<"V";n-=5;}while(n/1) {cout<<"I";n-=1;}return 0;}```## T4 [$\color{orange}\text{【K-1】恩格尔系数}$](https://www.luogu.com.cn/problem/U678883?contestId=324578)根据题目计算即可,下列给出的代码使用的是百分数比较。```cpp#include <iostream>using namespace std;32 行未改动11 行未改动1213141516171819207 行未改动282930313233343536373839404142434445464748495051525354555657585932 行未改动11 行未改动cout<<a+b;return 0;}```## T2 [$\color{red}\text{【K-R1-T2】四则运算计算器}$](https://www.luogu.com.cn/problem/U647071?contestId=324578)根据题目要求进行计算和输出对应算式即可。```cpp#include <iostream>using namespace std;7 行未改动if(c==4) cout<<a<<"/"<<b<<"="<<a/b;return 0;}```## T3 [$\color{red}\text{【K-R1-T3】罗马数字}$](https://www.luogu.com.cn/problem/U649172?contestId=324578)**注意特判 $4$ 和 $9$ 这两个数字即可。**```cpp#include <iostream>#include <string>using namespace std;int main(){int n;cin>>n;int v[]={1000,900,500,400,100,90,50,40,10,9,5,4,1};string r[]={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};string s;for(int i=0;i<13;i++){while(n>=v[i]){s+=r[i];n-=v[i];}if(n==0)break;}cout<<s<<endl;return 0;}```## T4 [$\color{orange}\text{【K-R1-T4】恩格尔系数}$](https://www.luogu.com.cn/problem/U678883?contestId=324578)根据题目计算即可,下列给出的代码使用的是百分数比较。```cpp#include <iostream>using namespace std;32 行未改动