cf链接
i Takeaway
#include<bits/stdc++.h>
using namespace std;
int price[8];
void init(){
price[1] = 7;
price[2] = 27;
price[3] = 41;
price[4] = 49;
price[5] = 63;
price[6] = 78;
price[7] = 108;
}
int main(){
init();
int t;
cin>>t;
while(t--){
int n;
cin >> n;
int now;
int sum = 0;
while(n--){
cin >> now;
sum += price[now];
}
if(sum>=120){
sum -= 50;
}else if(sum>=89){
sum -= 30;
}else if(sum>=69){
sum -= 15;
}
cout << sum << endl;
}
}
E-Easy Math Problem
构造
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
n *= 6;
cout << n << " " << 3 << endl;
cout << n / 6 << " " << n / 3 << " " << n / 2 << endl;
}
}
Master of shuangpin
模拟
# include <bits/stdc++.h>
using namespace std;
map<string, string> mp;
bool func(string str) {
mp["iu"] = "q";
mp["ei"] = "w";
mp["uan"] = "r";
mp["ue"] = "t";
mp["un"] = "y";
mp["sh"] = "u";
mp["ch"] = "i";
mp["uo"] = "o";
mp["ie"] = "p";
mp["ong"] = "s";
mp["iong"] = "s";
mp["ai"] = "d";
mp["en"] = "f";
mp["eng"] = "g";
mp["ang"] = "h";
mp["an"] = "j";
mp["uai"] = "k";
mp["ing"] = "k";
mp["uang"] = "l";
mp["iang"] = "l";
mp["ou"] = "z";
mp["ia"] = "x";
mp["ua"] = "x";
mp["ao"] = "c";
mp["zh"] = "v";
mp["ui"] = "v";
mp["in"] = "b";
mp["iao"] = "n";
mp["ian"] = "m";
if (mp[str] != "") {
return true;
}
if (mp[str] == "") {
return false;
}
}
string judge(string str) {
if (str.length() == 1) {
cout << str << str ;
} else if (str == "ang") {
cout << "ah";
} else if (str == "an") {
cout << "an";
} else if (str == "ai") {
cout << "ai";
} else if (str == "en") {
cout << "en";
} else if (str == "ao") {
cout << "ao";
}
else {
string substr = str.substr(0, 2);
if (func(substr)) {
if (func(str.substr(2))) {
cout << mp[substr] << mp[str.substr(2)] ;
}
else
cout << mp[substr] << str.substr(2) ;
}
else
{
if (func(str.substr(1))) {
cout << str[0] << mp[str.substr(1)] ;
}
else
cout << str[0] << str.substr(1) ;
}
}
return "";
}
int main() {
string str;
char s[6000];
while (gets(s)) {
for (int i = 0; s[i];i++){
if (s[i] != ' ') {
str += s[i];
} else {
judge(str);
cout << " ";
str = "";
}
}
judge(str);
str="";
s[0]=0;
cout << endl;
}
return 0;
}