- 博客(13)
- 收藏
- 关注
原创 C++中istringstream用法
它的作用是可以分割有空格的字符串(以前都是用两个for循环实现分割的完全没必要!)#include<iostream> #include<sstream> //istringstream 必须包含这个头文件#include<string> using namespace std; int main() { string str="i am a boy"; istringstream is(str); s
2021-03-09 10:47:57
228
原创 月饼(真坑)
#include<iostream>#include<algorithm>#include<string>#include<vector>#include<iomanip>using namespace std;struct moon{ double kucun; double price; double danprice;};bool comp1(moon const& a, moon const& b)
2021-03-04 16:12:38
85
1
原创 1041 考试座位号 (15 分)
#include<iostream>#include<algorithm>#include<string>#include<vector>using namespace std;struct stu{ string idcard; int shijihao; int kaoshihao;}st[1001];int main(){ int num; cin >> num; string n1; int n2; in
2021-03-02 20:14:17
46
原创 1042 字符统计 (20 分)
#include<iostream>#include<algorithm>#include<string>#include<vector>using namespace std;int main(){ string str; getline(cin,str); int i = 0; int time[256] = { 0 }; while (str[i] != '\0') { time[str[i]]++; i++; }
2021-03-02 20:08:03
95
1
原创 1039 到底买不买 (20 分)
ppRYYGrrYBR2258YrR8RrY第一行是摊主有的,第二行是小红想做的。我的思路是:先找出摊主所给的各个字符的个数,再比较…#include<iostream>#include<algorithm>#include<string>#include<vector>using namespace std;int main(){ string tanzhu, want; cin >> tanzhu >> wan
2021-03-02 14:41:39
34
原创 1038 统计同成绩学生 (20 分)
#include<iostream>#include<algorithm>#include<string>#include<vector>using namespace std;int main(){ int num; cin >> num; vector<int> stuscore(num); for (int i = 0; i < num; i++) cin >> stuscore[i];
2021-03-02 10:24:00
45
原创 1029 旧键盘
#include<iostream>#include<algorithm>#include <vector>#include <string>using namespace std;int main(){ string str1; string str2; cin >> str1 >> str2; int t = 0; string bad; for (int i = 0; i < str1.size();
2021-01-21 23:08:59
48
原创 1028 人口普查
#include<iostream>#include<algorithm>#include <vector>#include <string>using namespace std;struct people{ string name; int age;};bool cmp(people x, people y) { return x.age < y.age;}int main(){ int num; cin >
2021-01-21 00:00:31
49
原创 1027 打印沙漏
#include<iostream>#include<algorithm>#include <vector>#include <iomanip>using namespace std;int main(){ int shuru; char zifu; cin >> shuru >> zifu; /*while (sum<=shuru) { sum +=1*r+ (2 * t-1)*
2021-01-19 12:01:18
39
原创 1015 德才论 (25分)
#include<iostream>#include<vector>#include <string>#include<algorithm>using namespace std;struct stu{ string idcard; int descore; int caiscore;};bool operator<(const stu& a, const stu& b)//总分降序排序,德才分降序{ if (
2020-12-31 10:58:25
56
原创 1008 数组元素循环右移问题
#include<iostream>#include<vector>#include <string>#include<algorithm>using namespace std;int main(){ int num_number; cin >> num_number; int movenum; cin >> movenum; movenum = movenum % num_number; int t; v
2020-12-30 15:11:41
45
原创 1010 一元多项式求导
#include<iostream>#include<vector>#include <string>#include<algorithm>using namespace std;struct poly{ int xishu; int zhishu;};int main(){ vector<poly> v; vector<poly> v1; poly pol; int t; /*while ((t=
2020-12-30 15:04:32
63
原创 1012 数字分类
#include<iostream>#include<vector>#include <string>#include<algorithm>#include <iomanip>using namespace std;bool comp1(const int a, const int b){ if (a > b) return true; else return false;}int main(){ int
2020-12-30 14:58:32
107
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人