- 博客(11)
- 收藏
- 关注
原创 1002 A+B for Polynomials (25分)
#include <iostream>using namespace std;int main() { double a, ans[1001] = { 0 }; int k,n,count = 0; cin >> k; for (int i = 0; i < k; i++) { cin >> n >> a; count++; ans[n] = a; } cin >> k; for (int i= 0; i &l.
2021-01-26 22:02:55 78
原创 1001 A+B Format (20分)
#include <iostream>#include <string>using namespace std;int main (){ int a,b; cin>>a>>b; if(a+b<0) cout<<"-"; string ans=to_string(abs(a+b)); for(int i=0;i<ans.length();i++){ cout<<ans[i]; if(i!=an.
2021-01-26 21:11:56 83
原创 1003 Emergency (25分)
#include <iostream>using namespace std;int G[500][500] = { 0 };//路消耗 int N[500] = { 0 };//每个城市的人数int d[500] = { -1 };//到i的距离 int s[500] = { 0 };//到i最大救人数量int p[500] = { 0 };//到i的最短路径数量 bool v[500] = { false };int n, m, c1, c2;void Dj(int c1.
2020-11-16 22:21:36 96
原创 1034 Head of a Gang (30分)
#include<string>#include<iostream> #include<unordered_map> #include<vector> #include<algorithm>using namespace std;struct node { int value; int id;};int n, k, numb = 0,numbgang=0;vector<int> score(2000, 0).
2020-11-09 20:59:23 61
原创 1152 Google Recruitment (20分)
#include<string>#include<iostream>using namespace std;bool prime(int n){ if(n<=1) return false; for(int i=2;i*i<=n;i++) if(n%i==0) return false; return true;}int main(){ int n,k; string s; cin>>n>>k>>s; f.
2020-11-07 21:23:49 104
原创 1153 Decode Registration Card of PAT (25分)
#include<iostream>#include<string>#include<vector>#include<algorithm>#include<unordered_map>using namespace std;struct student{ string number; int score; string lever; string site; string date; string id;};bool .
2020-11-07 21:21:00 100
原创 1155 Heap Paths (30分)
#include<iostream>#include<vector>using namespace std;int n;bool maxheap=true,minheap=true;vector<int> heap(1001,0);vector<int> list(1000,0);void print(int numb){ for(int i=0;i<numb;i++){ if(i) cout<<" "; cout&.
2020-11-05 21:40:11 75
原创 C++标准模板库(STL)
C++标准模板库(STL)1.vector2.set3.string4.map/unordered_map5.queue6.priority_queue7.stack8.algorithm
2020-11-02 18:46:19 107
原创 一、向量(vector)
作用:vector可理解为“变长数组”,即使用过程中,长度可以变的数组,相对于普通数组而言,有如下优势:vector在定义时,长度这一参数可以为变量;vector在使用过程中,可以根据需求插入或剔除数据,同时向量长度会发生变化;以及很多我没发现的优势定义在定义之前,首先需要添加如下代码段:#include<vector>using namespace std;添加完成后,可根据标准形式定义vector变量vector<typename> ..
2020-06-30 10:37:57 1054 1
原创 1046 划拳 (15分)
很简单的一道题目,把题目看清楚就行了。划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。下面给出甲、乙两人的划拳记录,请你统计他们最后分别喝了多少杯酒。输入格式:输入第一行先给出一个正整数 N(≤100),随后 N 行,每行给出一轮划拳的记录,格式为:甲喊 甲划 乙喊 乙划其中喊是喊出的数字,划是划出
2020-06-10 09:06:48 83
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人