![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
Pipono
雨砌蝉花粘碧草,风檐萤火出苍苔。
展开
-
PAT乙级 1044 (****)
火星人是以 13 进制计数的: 地球人的 0 被火星人称为 tret。 地球人数字 1 到 12 的火星文分别为:jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec。 火星人将进位以后的 12 个高位数字分别称为:tam, hel, maa, huh, tou, kes, hei, elo, syy, lok, mer, jou。 例如地球人的数字 29 翻译成火星文就是 hel mar;而火星文 elo nov 对应地球数字 115。为了方原创 2020-09-19 17:04:22 · 127 阅读 · 1 评论 -
PAT 乙级 1042
简单记一下: string cin输入是不接受空格的。 使用 getline(cin,str);就可以,读取一行的信息。 #include <iostream> #include <string> using namespace std; int main() { //getline可以读取空格 string str; getline(cin,str); char bigLetter; int bigNum; int num[26]={0}; for(int i原创 2020-09-16 00:19:20 · 115 阅读 · 0 评论 -
乙级 1041,结构体实现。
简单记一下: 之前也作过类似的题。 定义一个类或者结构体就可以。 一开始想的是Map,后来觉得麻烦。 #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; struct test{ string id; int tryNum; int realNum; }; int main(int argc,原创 2020-09-06 23:14:25 · 82 阅读 · 0 评论 -
乙级PAT1029
#include <string> #include <iostream> using namespace std; string convert(string str) { for(int i =0;i<str.size();i++) { if(str[i]>='a'&&str[i]<='z') { str[i] -=32; } } return原创 2020-08-29 21:50:22 · 112 阅读 · 0 评论 -
PAT 乙级 1027 20/20
最开始计算每行的个数那里逻辑还不是很好,再想想。 要点:使用数组不方便,不如vector。 使用字符串打印字符,insert函数的使用。 #include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main(int argc, char *argv[]) { vector<int> a;原创 2020-08-21 22:34:43 · 120 阅读 · 0 评论 -
PAT乙级1024
#include <iostream> #include <sstream> #include <string> #include <algorithm> using namespace std; int main(int argc, char *argv[]) { string str; cin>>str; bool isPositiveNumber=true; if(str[0]=='+') {原创 2020-08-20 00:52:44 · 92 阅读 · 0 评论 -
PAT 乙级 1022
#include <iostream> #include <sstream> #include <string> #include <algorithm> using namespace std; int main(int argc, char *argv[]) { int a,b,jinzhi; cin>>a>>b>>jinzhi; stringstream ss; int sum =a原创 2020-08-18 07:54:57 · 79 阅读 · 0 评论 -
PAT 乙级1021-个位数统计
#include <iostream> using namespace std; #include <string> int main(int argc, char *argv[]) { string N; cin>>N; int num[10]={0}; for(int i=0;i<N.size();i++) { int m = N[i]-48; num[m]++; } for(原创 2020-08-14 07:30:43 · 82 阅读 · 0 评论 -
PAT1018 锤子剪刀布(满分20 得10分)
菜的不行。。。。记录一下用最笨的方法做的,有空回来看看哪里有问题。 #include <iostream> using namespace std; int main(int argc, char *argv[]) { int N,awin=0,bwin=0,abwin=0,ab=0,aj=0,ac=0,bb=0,bj=0,bc=0; char amax; char bmax; int asmax=0; int bsmax=0; cin>&g原创 2020-08-12 23:52:13 · 128 阅读 · 0 评论