- 博客(5)
- 收藏
- 关注
原创 PAT (Advanced Level) Practice 1005 Spell It Right (20)
本题难度不大,仅是string与long转换 #include<iostream> #include <sstream> #include<string> #include <stdlib.h> using namespace std; long add(string &str) { long res=0; for (int i = ...
2018-08-02 00:29:10 170
原创 PAT (Advanced Level) Practice 1035 Password (20)
本题为字符串替换 #include<iostream> #include<string> using namespace std; int check(string& str) { for (int i = 0; i < str.length(); i++) { if (str.find("0")==-1 && str.find("O...
2018-08-01 23:49:05 105
原创 PAT (Advanced Level) Practice 1027 Colors in Mars (20)
实质为进制转换 #include<iostream> #include<string> using namespace std; string cha(int num) { char hi='0', lo='0'; if (num <=12) { if (num <= 9) { lo = num+'0'; } else if (num ...
2018-08-01 22:35:26 102
原创 PAT (Advanced Level) Practice 1001 A+B Format (20) C++
本题主要考察边界条件判断,数字取模取余运算。 #include <iostream> #include <cstdio> #include <string> #include<iomanip> using namespace std; int main(void) { long n,m; cin >> n >> m; ...
2018-07-20 15:04:35 185
原创 PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25) C++
此程序主要使用到strcmp(s1,s2)与strcpy(s1,s2)两个函数: strcmp(s1,s2):比较两个字符串大小;s1>s2返回正整数,s1<s2返回负整数,s1=s2返回0. strcpy(s1,s2):s2赋给s1。 #include <iostream> #include <cstdio> #include <...
2018-07-20 13:53:07 192
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人