十一模拟1 1480. 电梯 PAT甲级真题1008

//1480. 电梯
//我们城市的最高建筑上只有一部电梯。
//
//给定一个由 N个整数组成的请求列表。
//
//我们要按照列表指定的顺序,将电梯依次停到各个楼层。
//
//已知,电梯上行一层需要 6秒,
//下行一层需要 4秒,
//每个停留楼层每次停留 5秒。
//
//请你求出,将列表给出的所有楼层都按指定顺序完成停留共需多少秒。
//
//电梯开始时位于第 0层,所有楼层均停留完毕后,电梯不用回归原位置。
//
//补充
//可能存在连续在同一楼层停留多次的情况,此时每停留一次就要等待5秒钟。
//
//输入格式
//共一行,首先包含一个整数 N,然后包含 N个正数。
//
//输出格式
//输出一个整数,表示所花费的总时间。
//
//数据范围
//1≤N≤100,
//列表中的数字不会超过 100。
//
//输入样例:
//3 2 3 1
//输出样例:
//41#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;//yxc
class Solution {
public:void func() {int n;cin >> n;int res = 0;int last = 0;while (n--){int cur;cin >> cur;if (last < cur) res += (cur - last) * 6;else res += (last - cur) * 4;res += 5;last = cur;}cout << res << endl;}
};//我
class Solution2 {
public:void func() {int n;cin >> n;int v[110] = { 0 };for (int i = 1; i <= n; i++) {cin >> v[i];}int res = 0;for (int i = 0; i < n; i++) {if (v[i + 1] > v[i]) {res += 6 * (v[i + 1] - v[i]) + 5;}else if (v[i + 1] < v[i]) {res += 4 * (v[i] - v[i + 1]) + 5;}else {res += 5;}}cout << res;}
};int main()
{Solution2 s;s.func();return 0;
}

十一模拟2 1483. 世界杯投注 PAT甲级真题1011

//1483. 世界杯投注
//
//随着 2010年FIFA世界杯的举办,世界各地的足球迷变得越来越兴奋,因为来自各个顶级队伍的顶级球员们正在为南非的世界杯奖杯而战。
//
//同样,足球投注迷们也拿出了大把的金钱,投入到了各种形式的世界杯投注之中。
//
//中国足球彩票提供了一种叫做“三连胜”的游戏。
//
//获胜的规则很简单:首先选择其中三场比赛。 然后,对于每个选定的比赛,
//下注三个可能的结果之一----W代表胜利,T代表平局,L代表失败。
//每个结果都有一个赔率。 获胜者(三场都压中结果)的赔率将是三个下注结果的赔率的乘积乘以 65 %以后得到的值。
//
//例如,以下是三场比赛的赔率:
//
//W    T    L
//1.1  2.5  1.7
//1.2  3.1  1.6
//4.1  1.2  1.1
//为了获得最大的利润,我们需要在前两场买平局,第三场买胜利。
//
//如果投注 2元,那么最大利润将是(4.1×3.1×2.5×65 % −1)×2 = 39.31元(最多 2位小数)。
//
//输入格式
//输入共三行,每行包含三个浮点数,分别表示一场比赛的胜利(W),平局(T),失败(L)的赔率。
//
//输出格式
//输出共一行,先输出可获得最大利润的投注方式,
//即三场比赛分别投注什么结果(用字母表示),再输出可获得的最大利润(在投注 2元的情况下),注意结果保留两位小数。
//
//数据范围
//每场比赛每个结果的赔率都是正数,且不会超过 5。
//同一场比赛的三个结果的赔率不可能相同。
//
//输入样例:
//1.1 2.5 1.7
//1.2 3.1 1.6
//4.1 1.2 1.1
//输出样例:
//T T W 39.31#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;//yxc
class Solution {
public:void func() {double res = 1;for (int i = 0; i < 3; i++){double w, t, l;cin >> w >> t >> l;double x = max(w, max(t, l));if (x == w) cout << "W ";else if (x == t) cout << "T ";else cout << "L ";res *= x;}printf("%.2lf\n", (res * 0.65 - 1) * 2);}
};//我
class Solution2 {
public:void func() {double res = 1;for (int i = 0; i < 3; i++) {double w, t, l;cin >> w >> t >> l;double x = max(w, max(t, l));if (x == w) {cout << "W ";}else if (x == t) {cout << "T ";}else {cout << "L ";}res = res * x;}printf("%.2lf", (res * 0.65 - 1) * 2);}
};int main() {Solution2 s;s.func();return 0;
}

十一模拟3 1486. 排队等候 PAT甲级真题1014

//1486. 排队等候
//
//假设一家银行有 N个服务窗口。
//
//窗户前面有一条黄线,将等候区分为两部分。
//
//客户排队等候的规则是:
//
//在黄线以内的区域,每个窗口前都可以排一队人,每队最多可以排 M个人,
//当 N个窗口前的队伍都排满时,第 NM + 1个顾客以及以后的顾客只能在黄线以外的区域等候。
//黄线外的所有客户统一排成一个长队。
//每当客户进入黄线以内时,他会选择到当前排队人数最少的窗口处排队等待办理业务。
//当多个窗口前排队人数最少时,客户会选择窗口编号更小的窗口处排队等待办理业务。
//第 i名客户的办理业务时长为 Ti。
//最开始的 N名客户将于早上 08:00 被受理业务。
//现在,给定所有客户办理业务所需的时间,并对你进行若干次询问,每次询问一名客户办理完自身业务时的确切时间。
//
//例如,假设银行共有 2
//个服务窗口,每个窗口内可以有两名客户排在黄线以内。
//现在共有 5名客户等待办理业务,他们的业务时长分别为 1, 2, 6, 4, 3分钟。
//
//早上 08:00 时,客户 1在窗口 1接受服务,
//客户 2在窗口 2接受服务,
//客户 3在窗口 1前等待,
//客户 4在窗口 2前等待,
//客户 5在黄线以外等待。
//
//在 08:01,客户 1办完业务,
//客户 5进入黄线以内,并于窗口 1前等待。
//
//客户 2将于 08:02 办完业务,
//客户 4将于 08 : 06 办完业务,
//客户 3将于 08 : 07 办完业务,
//客户 5将于 08 : 10 办完业务。
//
//输入格式
//第一行包含 4个整数,N, M, K, Q,分别表示窗口总数,黄线内每个队伍的最大长度,客户总数,询问次数。
//
//第二行包含 K个整数,表示每个客户办理业务的所需时长(单位:分钟)。
//
//第三行包含 Q个整数,表示询问的所有客户的编号。
//
//客户编号从 1到 K。
//
//输出格式
//对于每个询问的客户,输出其办理完业务的确切时间,格式为 HH : MM。
//
//注意,银行 17 : 00 就会停止受理新的业务,
//所以对于不能在 17 : 00 之前(即最晚可以开始服务的时间是16 : 59)开始办理业务的客户,要输出 Sorry。
//
//数据范围
//1≤N≤20,
//1≤M≤10,
//1≤K≤1000,
//1≤Q≤K
//
//输入样例:
//2 2 7 5
//1 2 6 4 3 534 2
//3 4 5 6 7
//
//输出样例:
//08:07
//08:06
//08:10
//17:00
//Sorry#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;const int N = 20;//队列最多20个//yxc
int n, m, k, Q;
int sum[N];//总共多少时间
queue<int> q[N];//n个队列,存储每个窗口的队列是什么
class Solution {
public:void func() {// n, m, k, q,分别表示窗口总数,黄线内每个队伍的最大长度,客户总数,询问次数。cin >> n >> m >> k >> Q;unordered_map<int, int> hash;//哈希表,存储答案for (int i = 1; i <= k; i++)//遍历所有客户,还得看下前n*m个人,不能while(k--),{int s;//当前的人花多少时间cin >> s;int t = 0;//当前的人在哪个窗口,t=0是零号窗口//for一遍决定来的人 排在哪个窗口后面for (int j = 0; j < n; j++)//从前往后遍历窗口if (i <= n * m)//如果是前n*m个人{//找队伍人数最少的//如果j号窗口队伍人数少,则更新当前窗口为j号,即t=jif (q[j].size() < q[t].size()) t = j;}else//如果不是前n*m个人,即n个窗口的队伍都排满了{//看哪个队伍队首的 完成任务时间最少,就排到哪个队伍后面if (q[j].front() < q[t].front()) t = j;}sum[t] += s;//当前窗口的队伍的完成任务总时间 加上 s(当前人花的世界)//i>n*m,说明有人已经服务完了,当前窗口队首出队if (i > n * m) q[t].pop();q[t].push(sum[t]);//插入当前人的 完成任务的时间//服务时间早8点到晚5点,9小时,540分钟//将当前客户i的完成任务消耗的时间(以分钟表示)(包括等待时间) 存入哈希表if (sum[t] - s < 540) hash[i] = sum[t];}while (Q--){int id;cin >> id;if (hash.count(id)) printf("%02d:%02d\n", hash[id] / 60 + 8, hash[id] % 60);else puts("Sorry");}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟4 1515. U 形 Hello World PAT甲级真题1031

1515. U 形 Hello World

给定一个长度为 N 的字符串,请你将它以 U 形输出。

例如,helloworld 可以输出为:

h  d
e  l
l  r
lowo

也就是说,必须按照原始顺序输出字符,左垂直线自上而下共有 n1 个字符,底部行从左到右共有 n2 个字符,右垂直线自下而上共有 n3 个字符。

另外,必须满足 n1=n3=max{k|k≤n2对于所有3≤n2≤N}以及 n1+n2+n3−2=N。

对于 helloworld,n1=n2=n3=4

输入格式

包含一个长度不少于 55 且不超过 8080 的字符串,字符串内不含空格。

输出格式

输出转化为 U 形后的图案。

输入样例:

helloworld!

输出样例:

h   !
e   d
l   l
lowor

N=2n1+n2-2---->n2=N-2n1+2,又因为n1<=n2,代入,得n1<=N-2n1+2--->3n1<=N+2-->

n1<=(N+2)/3

又因为n1=n3=max{k},且k<=n2,即n1=n3要取满足小于等于n2时候的最大值k

所以n1取(N+2)/3!!!!!

//1515. U 形 Hello World
//
//给定一个长度为N的字符串,请你将它以U形输出。
//
//例如,helloworld 可以输出为:
//h  d
//e  l
//l  r
//lowo
//也就是说,必须按照原始顺序输出字符,左垂直线自上而下共有 n1个字符,
//底部行从左到右共有 n2个字符,右垂直线自下而上共有 n3个字符。
//
//另外,必须满足 n1 = n3 = max{ k | k≤n2对于所有3≤n2≤N }以及 n1 + n2 + n3−2 = N。
//
//对于 helloworld,n1 = n2 = n3 = 4。
//
//输入格式
//包含一个长度不少于5且不超过80的字符串,字符串内不含空格。
//
//输出格式
//输出转化为 U
//形后的图案。
//
//输入样例:
//helloworld!
//
//输出样例:
//h   !
//e   d
//l   l
//lowor#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;const int N = 100;//yxc
char g[N][N];
class Solution {
public:void func() {string str;cin >> str;int n = str.size();int n1 = (n + 2) / 3;//通过题目给出的公式推导得出int n2 = n + 2 - n1 * 2;//由公式n1+n2+n3-2=n,n1=n3得出int k = 0;//输入字符串的下标,从0开始//先输入U形 最左边的字符串,即n1//下标就用题目给的例子去看就行了,其实可以i都从1开始,比较好弄for (int i = 0; i < n1; i++) g[i][0] = str[k++];for (int i = 1; i < n2; i++) g[n1 - 1][i] = str[k++];for (int i = n1 - 2; i >= 0; i--) g[i][n2 - 1] = str[k++];for (int i = 0; i < n1; i++){for (int j = 0; j < n2; j++)if (g[i][j]) cout << g[i][j];else cout << ' ';cout << endl;}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟5 1525. 独一无二 PAT甲级真题1041

1525. 独一无二

对于火星人来说,保持独一无二非常的重要。

以至于他们的彩票都是以独特的方式设计的。

中奖规则十分简单,每一个买彩票的人选中一个范围在 [1,104][1,104] 的数字,将所有数字按购买顺序排成一排。

数列中,只出现过一次且排位最靠前的那个数字就是中奖号码。

例如,77 个人购买了彩票,所买数字依次是 5 31 5 88 67 88 17,则第二个数字 31 为中奖号码。

输入格式

共一行,首先包含一个整数 N,表示共有 N 个投注号码,然后跟随 N 个数字,表示投注号码。

数字之间用空格隔开。

输出格式

输出中奖号码。

如果没人中奖,则输出 None

数据范围

1≤N≤105

输入样例1:

7 5 31 5 88 67 88 17

输出样例1:

31

输入样例2:

5 888 666 666 888 888

输出样例2:

None

Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one who bets on a unique number wins. For example, if there are 7 people betting on 5 31 5 88 67 88 17, then the second one who bets on 31 wins.

Input Specification:

Each input file contains one test case. Each case contains a line which begins with a positive integer N (<=105) and then followed by N bets. The numbers are separated by a space.

Output Specification:

For each test case, print the winning number in a line. If there is no winner, print "None" instead.

Sample Input 1:

7 5 31 5 88 67 88 17

Sample Output 1:

31

Sample Input 2:

5 888 666 666 888 888

Sample Output 2:

None

题目大意:给n个数字,按照读入顺序,哪个数字是第一个在所有数字中只出现一次的数字。如果所有数字出现都超过了一次,则输出None

分析:建立一个哈希表,存储每个数字出现的次数,遍历一遍第一次出现的次数为1点数字便是所求

//1525. 独一无二
//
//对于火星人来说,保持独一无二非常的重要。
//
//以至于他们的彩票都是以独特的方式设计的。
//
//中奖规则十分简单,每一个买彩票的人选中一个范围在[1, 104]的数字,将所有数字按购买顺序排成一排。
//
//数列中,只出现过一次且排位最靠前的那个数字就是中奖号码。
//
//例如,7个人购买了彩票,所买数字依次是 5 31 5 88 67 88 17,则第二个数字 31 为中奖号码。
//
//输入格式
//共一行,首先包含一个整数 N,表示共有 N个投注号码,然后跟随 N个数字,表示投注号码。
//
//数字之间用空格隔开。
//
//输出格式
//输出中奖号码。
//
//如果没人中奖,则输出 None。
//
//数据范围
//1≤N≤105
//
//输入样例1:
//7 5 31 5 88 67 88 17
//输出样例1:
//31
//
//输入样例2:
//5 888 666 666 888 888
//输出样例2:
//None#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;const int N = 100010;
int n;
int a[N];//原数组
int c[N];//个数
class Solution {
public:void func() {cin >> n;for (int i = 0; i < n; i++){cin >> a[i];c[a[i]] ++;}for (int i = 0; i < n; i++){if (c[a[i]] == 1){cout << a[i] << endl;return;}}cout<<"None";}
};
//我
vector<int> v;
unordered_map<int, int> mp;
class Solution2 {
public:void func() {cin >> n;for (int i = 0; i < n; i++) {int k;cin >> k;v.push_back(k);mp[k]++;}for (int i = 0; i < n; i++) {if (mp[v[i]] == 1) {cout << v[i] << endl;return;}}cout << "None";}};int main() {Solution2 s;s.func();return 0;
}

十一模拟6 1526. 洗牌机 PAT甲级真题1042

1526. 洗牌机

洗牌就是将一副牌的顺序打乱。

为了防止员工洗牌不够彻底或者员工串通赌徒出老千,许多娱乐场都用自动洗牌机来洗牌。

洗牌机会根据一套随机产生的打乱顺序,将一套牌(5454 张)进行若干次的洗牌操作。

假设一副牌的最开始时按如下顺序排列:

S1, S2, ..., S13,
H1, H2, ..., H13,
C1, C2, ..., C13,
D1, D2, ..., D13,
J1, J2

其中,S表示黑桃,H表示红桃,C表示草花,D表示方块,J表示小丑。

给定一个 1∼541∼54 的排列表示打乱顺序,如果第 i 个位置的数字是 j,则意味着现在处于位置 i 的卡牌在洗牌结束后要出现在位置 j。

假设我们一共只有 55 张卡牌,S3, H5, C1, D13, J2,给定的打乱顺序为 {4, 2, 5, 3, 1}

洗牌一次后,卡牌顺序变为 J2, H5, D13, S3, C1,再洗一次,卡牌顺序变为 C1, H5, S3, J2, D13

输入格式

第一行包含整数 K,表示洗牌次数。

第二行包含一个 1∼541∼54 的排列,表示打乱顺序。

输出格式

输出洗牌完成后的最终卡牌顺序。

占一行。

数据范围

K≤20

输入样例:

2
36 52 37 38 3 39 40 53 54 41 11 12 13 42 43 44 2 4 23 24 25 26 27 6 7 8 48 49 50 51 9 10 14 15 16 5 17 18 19 1 20 21 22 28 29 30 31 32 33 34 35 45 46 47

输出样例:

S7 C11 C10 C12 S1 H7 H8 H9 D8 D9 S11 S12 S13 D10 D11 D12 S3 S4 S6 S10 H1 H2 C13 D2 D3 D4 H6 H3 D13 J1 J2 C1 C2 C3 C4 D1 S5 H5 H11 H12 C6 C7 C8 C9 S2 S8 S9 H10 D5 D6 D7 H4 H13 C5

Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers by performing inadequate shuffles, many casinos employ automatic shuffling machines. Your task is to simulate a shuffling machine.

The machine shuffles a deck of 54 cards according to a given random order and repeats for a given number of times. It is assumed that the initial status of a card deck is in the following order:

S1, S2, …, S13, H1, H2, …, H13, C1, C2, …, C13, D1, D2, …, D13, J1, J2

where “S” stands for “Spade”, “H” for “Heart”, “C” for “Club”, “D” for “Diamond”, and “J” for “Joker”. A given order is a permutation of distinct integers in [1, 54]. If the number at the i-th position is j, it means to move the card from position i to position j. For example, suppose we only have 5 cards: S3, H5, C1, D13 and J2. Given a shuffling order {4, 2, 5, 3, 1}, the result will be: J2, H5, D13, S3, C1. If we are to repeat the shuffling again, the result will be: C1, H5, S3, J2, D13.

Input Specification:

Each input file contains one test case. For each case, the first line contains a positive integer K (<= 20) which is the number of repeat times. Then the next line contains the given order. All the numbers in a line are separated by a space.

Output Specification:

For each test case, print the shuffling results in one line. All the cards are separated by a space, and there must be no extra space at the end of the line.

Sample Input:

2
36 52 37 38 3 39 40 53 54 41 11 12 13 42 43 44 2 4 23 24 25 26 27 6 7 8 48 49 50 51 9 10 14 15 16 5 17 18 19 1 20 21 22 28 29 30 31 32 33 34 35 45 46 47

Sample Output:

S7 C11 C10 C12 S1 H7 H8 H9 D8 D9 S11 S12 S13 D10 D11 D12 S3 S4 S6 S10 H1 H2 C13 D2 D3 D4 H6 H3 D13 J1 J2 C1 C2 C3 C4 D1 S5 H5 H11 H12 C6 C7 C8 C9 S2 S8 S9 H10 D5 D6 D7 H4 H13 C5

分析:简单模拟。使用start和end数组保存每一次变换的开始顺序和结束顺序(以1~54的编号存储),最后根据编号与扑克牌字母数字的对应关系输出end数组

//1526. 洗牌机
//
//洗牌就是将一副牌的顺序打乱。
//
//为了防止员工洗牌不够彻底或者员工串通赌徒出老千,许多娱乐场都用自动洗牌机来洗牌。
//
//洗牌机会根据一套随机产生的打乱顺序,将一套牌(54张)进行若干次的洗牌操作。
//
//假设一副牌的最开始时按如下顺序排列:
//
//S1, S2, ..., S13,
//H1, H2, ..., H13,
//C1, C2, ..., C13,
//D1, D2, ..., D13,
//J1, J2
//其中,S表示黑桃,H表示红桃,C表示草花,D表示方块,J表示小丑。
//
//给定一个 1∼54的排列表示打乱顺序,如果第 i个位置的数字是 j,
//则意味着现在处于位置 i的卡牌在洗牌结束后要出现在位置 j。
//
//假设我们一共只有 5张卡牌,
//S3, H5, C1, D13, J2,给定的打乱顺序为{ 4, 2, 5, 3, 1 }。
//洗牌一次后,卡牌顺序变为 J2, H5, D13, S3, C1,
//再洗一次,卡牌顺序变为 C1, H5, S3, J2, D13。
//
//输入格式
//第一行包含整数 K,表示洗牌次数。
//
//第二行包含一个 1∼54的排列,表示打乱顺序。
//
//输出格式
//输出洗牌完成后的最终卡牌顺序。占一行。
//
//数据范围
//K≤20
//输入样例:
//2
//36 52 37 38 3 39 40 53 54 41 11 12 13 42 43 44 2 4 23 24 25 26 27 6 7 8 48 49 50 51 9 10 14 15 16 5 17 18 19 1 20 21 22 28 29 30 31 32 33 34 35 45 46 47
//输出样例:
//S7 C11 C10 C12 S1 H7 H8 H9 D8 D9 S11 S12 S13 D10 D11 D12 S3 S4 S6 S10 H1 H2 C13 D2 D3 D4 H6 H3 D13 J1 J2 C1 C2 C3 C4 D1 S5 H5 H11 H12 C6 C7 C8 C9 S2 S8 S9 H10 D5 D6 D7 H4 H13 C5#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;
const int N = 60;#include <cstring>
int k;
int q[N];//输出的序列,第1个数放到q[1]的位置上
int p[N];//排列
int w[N];//临时
class Solution {
public:void print(int x){if (x <= 13) cout << 'S' << x;else if (x <= 26) cout << 'H' << x - 13;else if (x <= 39) cout << 'C' << x - 26;else if (x <= 52) cout << 'D' << x - 39;else cout << 'J' << x - 52;}void func() {cin >> k;for (int i = 1; i <= 54; i++) cin >> q[i];//下标i的数字放到下标q[i]上for (int i = 1; i <= 54; i++) p[i] = i;//1-54的排列//k次循环,先把p放临时数组w里,然后用q对w置换,结果放p里//我的话,也可以先把p用q置换,结果放w里,再用w去覆盖掉p,p就是结果while (k--){//先把p复制到临时数组w里memcpy(w, p, sizeof w);//memcpy(void* to,void* from,int number)//要头文件#include <cstring>//开始置换,置换完了结果在p里for (int i = 1; i <= 54; i++) p[q[i]] = w[i];我法,也可以这样//for (int i = 1; i <= 54; i++) w[q[i]] = p[i];//for (int i = 1; i <= 54; i++) p[i] = w[i];}for (int i = 1; i <= 54; i++){print(p[i]);if (i != 54) cout << ' ';}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟7 1531. 课程学生列表 PAT甲级真题1047

题目描述
浙江大学有 40000 名学生,提供 2500 门课程。

现在给定每个学生的选课列表。

请你统计,每门课程的学生报名情况。

输入格式
第一行包含两个整数 N 和 K,分别表示学生总数和课程总数。

接下来 N 行,每行包含一个学生的选课列表,首先包含学生姓名(三个大写字母加一位数字),然后包含一个整数 C,表示该学生报课总数,接下来包含 C 个整数,表示所报课程编号。

所有课程编号为 1∼K。

输出格式
按照课程编号升序的顺序输出每一门课的报名情况。

每门课输出信息时,第一行包含两个整数,分别表示课程编号以及报名人数。

接下来若干行,按字典序输出报名的具体人员姓名,每个姓名占一行。

数据范围
1≤N≤40000,
1≤K≤2500,
1≤C≤20,

输入样例:
10 5
ZOE1 2 4 5
ANN0 3 5 2 1
BOB5 5 3 4 2 1 5
JOE4 1 2
JAY9 4 1 2 5 4
FRA8 3 4 2 5
DON2 2 4 5
AMY7 1 5
KAT3 3 5 4 2
LOR6 4 2 4 1 5
输出样例:
1 4
ANN0
BOB5
JAY9
LOR6
2 7
ANN0
BOB5
FRA8
JAY9
JOE4
KAT3
LOR6
3 1
BOB5
4 7
BOB5
DON2
FRA8
JAY9
KAT3
LOR6
ZOE1
5 9
AMY7
ANN0
BOB5
DON2
FRA8
JAY9
KAT3
LOR6
ZOE1

某个思路:结构体1存放学生姓名和vector,vector存放课程编号。结构体2存放课程编号和vector,vector存放学生姓名。读入数据放入结构体1数组,遍历该数组取出学生,再遍历其vector,根据课程编号,放入结构体2,输出结构体2

//1531. 课程学生列表
//
//浙江大学有 40000名学生,提供 2500门课程。
//
//现在给定每个学生的选课列表。
//
//请你统计,每门课程的学生报名情况。
//
//输入格式
//第一行包含两个整数N和K,分别表示 学生总数 和 课程总数。
//
//接下来N行,每行包含一个学生的选课列表,首先包含学生姓名(三个大写字母加一位数字),
//然后包含一个整数 C,表示该学生报课总数,接下来包含 C个整数,表示所报课程编号。
//
//所有课程编号为 1∼K。
//
//输出格式
//按照课程编号 升序 的顺序输出 每一门课 的报名情况。
//
//每门课输出信息时,第一行包含两个整数,分别表示 课程编号 以及 报名人数。
//
//接下来若干行,按 字典序 输出报名的 具体人员姓名,每个姓名占一行。
//
//数据范围
//1≤N≤40000,
//1≤K≤2500,
//1≤C≤20,
//
//输入样例:
//10 5 //学生总数10,课程总数5
//ZOE1 2 4 5//学生姓名ZOE1,报课总数2,课程编号4,5
//ANN0 3 5 2 1//学生行么ANN0,报课总数3,课程编号5,2,1
//BOB5 5 3 4 2 1 5
//JOE4 1 2
//JAY9 4 1 2 5 4
//FRA8 3 4 2 5
//DON2 2 4 5
//AMY7 1 5
//KAT3 3 5 4 2
//LOR6 4 2 4 1 5
//输出样例:
//1 4//课程编号1,报名人数4
//ANN0//字典顺序输出报名人员的姓名
//BOB5
//JAY9
//LOR6
//2 7
//ANN0
//BOB5
//FRA8
//JAY9
//JOE4
//KAT3
//LOR6
//3 1
//BOB5
//4 7
//BOB5
//DON2
//FRA8
//JAY9
//KAT3
//LOR6
//ZOE1
//5 9
//AMY7
//ANN0
//BOB5
//DON2
//FRA8
//JAY9
//KAT3
//LOR6
//ZOE1#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
#include <cstring>
using namespace std;const int N = 2510;yxc
int n, k;
vector<string> lesson[N];
class Solution {
public:void func() {//scanf("%d%d", &n, &k);cin >> n >> k;char str[5];while (n--){int cnt;//scanf("%s%d", str, &cnt);cin >> str >> cnt;while (cnt--){int l;//scanf("%d", &l);cin >> l;lesson[l].push_back(str);}}for (int i = 1; i <= k; i++){printf("%d %d\n", i, lesson[i].size());sort(lesson[i].begin(), lesson[i].end());for (auto id : lesson[i])printf("%s\n", id.c_str());}}
};//为啥我超时
//int n, k;
//vector<vector<string>> v;
vector<string> v[N];
vector<string> v2;
class Solution2 {
public:bool cmp(string a,  string b) {return a < b;}void func() {cin >> n >> k;//v.resize(N);//等价于创建一个 vector<string> v[N]for (int i = 0; i < n; i++) {string s = "";//学生姓名cin >> s;int t;//学生有几门课cin >> t;for (int i = 1; i <= t; i++) {int c;cin >> c;v[c].push_back(s);}}for (int i = 1; i <= k; i++) {sort(v[i].begin(), v[i].end());cout << i << ' ' << v[i].size() << endl;for (int j = 0; j < v[i].size(); j++) {cout << v[i][j] << endl;}}}
};int main() {Solution2 s;s.func();return 0;
}

十一模拟8 1540. 主导颜色 PAT甲级真题1054

//1540. 主导颜色
//
//给定一个分辨率为 M×N的屏幕,每个像素都有一个颜色,
//如果超过一半的像素都显示同一种颜色,则这个颜色就称之为主导颜色。
//
//现在,请你确定屏幕的主导颜色。
//
//输入格式
//第一行包含两个整数 M和 N。
//
//接下来 N行,每行包含 M个数字,每个数字表示一种颜色。
//
//输出格式
//输出一个整数,表示主导颜色的编号。
//
//数据范围
//1≤M≤800,1≤N≤600,
//颜色编号取值在[0, 224)范围内,
//数据保证主导颜色一定存在。
//
//输入样例:
//5 3
//0 0 255 16777215 24
//24 24 0 0 24
//24 0 24 24 24
//
//输出样例:
//24#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;//yxc
class Solution {
public:void func() {int n, m;//scanf("%d%d", &n, &m);cin >> n >> m;unordered_map<int, int> cnt;for (int i = 0; i < n * m; i++) {int x;//scanf("%d", &x);cin >> x;//cnt[x]++;if (++cnt[x] > n * m / 2){//这里用++cnt[x]确实能加快运行速度printf("%d\n", x);break;}}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟9 1542. 老鼠和大米 PAT甲级真题1056

1542. 老鼠和大米

老鼠和大米是一个编程竞赛的主题,程序员们需要编写代码控制老鼠在给定的地图上移动,每只老鼠的目标都是吃掉尽可能多的大米,从而变成肥老鼠。

共有 NP个程序员参赛,入场顺序随机,每 NG个程序员被分为一组。

组中最胖的老鼠获胜,并进入下一轮。

所有在本回合中失败的老鼠排名都相同。

获胜者继续每 NG 个一组,进行比赛,直到决出唯一胜者为止。

为了简单起见,当程序员们提交了代码后,他们的老鼠的最终重量就已经确定了。

给定所有老鼠的重量和程序员们的参赛顺序,请你为程序员们排名。

输入格式

第一行包含两个整数 NP 和 NG,分别表示总参赛人数以及每组最多人数。

如果分组到最后,剩下不足 NG 个人,则剩下的所有人分为一组。

所有 NP 只老鼠的编号为 0∼NP−1。

第二行包含 NP 个不同的非负整数 Wi(i=0,1,…,NP−1),其中 Wi 表示编号为 i 的老鼠的重量。

第三行包含一个 0∼NP−1 的排列,表示老鼠的具体参赛顺序,以样例为例,66 号老鼠排在第一个,00 号老鼠排在第二个,以此类推。

输出格式

输出一行 NP 个整数,其中第 i 个整数表示编号为 i 的老鼠的最终排名。

数据范围

1≤NP≤1000,
2≤NG≤1000,
0≤Wi≤1000。

输入样例:

11 3
25 18 0 46 37 3 19 22 57 56 10
6 0 8 7 10 5 9 1 4 2 3

输出样例:

5 5 5 2 5 5 5 3 1 3 5

Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice as possible in order to become a FatMouse.

First the playing order is randomly decided for NP programmers. Then every NG programmers are grouped in a match. The fattest mouse in a group wins and enters the next turn. All the losers in this turn are ranked the same. Every NG winners are then grouped in the next match until a final winner is determined.

For the sake of simplicity, assume that the weight of each mouse is fixed once the programmer submits his/her code. Given the weights of all the mice and the initial playing order, you are supposed to output the ranks for the programmers.

Input Specification:

Each input file contains one test case. For each case, the first line contains 2 positive integers: NP and NG (<= 1000), the number of programmers and the maximum number of mice in a group, respectively. If there are less than NG mice at the end of the player's list, then all the mice left will be put into the last group. The second line contains NP distinct non-negative numbers Wi (i=0,...NP-1) where each Wi is the weight of the i-th mouse respectively. The third line gives the initial playing order which is a permutation of 0,...NP-1 (assume that the programmers are numbered from 0 to NP-1). All the numbers in a line are separated by a space.

Output Specification:

For each test case, print the final ranks in a line. The i-th number is the rank of the i-th programmer, and all the numbers must be separated by a space, with no extra space at the end of the line.

Sample Input:
11 3
25 18 0 46 37 3 19 22 57 56 10
6 0 8 7 10 5 9 1 4 2 3

Sample Output:
5 5 5 2 5 5 5 3 1 3 5

题目大意:np为老鼠的数量,ng为每组最多g个老鼠。先给出np个老鼠的重量,再给出老鼠的初始顺序(第i名的老鼠是第j号,j从0开始)。每ng个老鼠分为一组,对于每组老鼠,选出最重的那个,晋级下一轮比赛,然后依次再以np个老鼠一组分类,然后选出重量最大的。。。直到只剩下一只老鼠,排名为1.输出为老鼠的排名,这个排名是按照原输入老鼠的顺序输出的

//1542. 老鼠和大米
//
//老鼠和大米是一个编程竞赛的主题,程序员们需要编写代码控制老鼠在给定的地图上移动,
//每只老鼠的目标都是吃掉尽可能多的大米,从而变成肥老鼠。
//
//共有 NP个程序员参赛,入场顺序随机,每 NG个程序员被分为一组。
//
//组中最胖的老鼠获胜,并进入下一轮。
//
//所有在本回合中失败的老鼠排名都相同。
//
//获胜者继续每 NG个一组,进行比赛,直到决出唯一胜者为止。
//
//为了简单起见,当程序员们提交了代码后,他们的老鼠的最终重量就已经确定了。
//
//给定所有老鼠的重量和程序员们的参赛顺序,请你为程序员们排名。
//
//输入格式
//第一行包含两个整数 NP和 NG,分别表示总参赛人数以及每组最多人数。
//
//如果分组到最后,剩下不足 NG个人,则剩下的所有人分为一组。
//
//所有 NP只老鼠的编号为 0∼NP−1。
//
//第二行包含 NP个不同的非负整数 Wi(i = 0, 1, …, NP−1),
//其中 Wi表示编号为 i的老鼠的重量。
//
//第三行包含一个 0∼NP−1的排列,表示老鼠的具体参赛顺序,以样例为例,
//6号老鼠排在第一个,0号老鼠排在第二个,以此类推。
//
//输出格式
//输出一行 NP个整数,其中第 i个整数表示编号为 i的老鼠的最终排名。
//
//数据范围
//1≤NP≤1000,
//2≤NG≤1000,
//0≤Wi≤1000。
//
//输入样例:
//11 3
//25 18 0 46 37 3 19 22 57 56 10
//6 0 8 7 10 5 9 1 4 2 3
//
//输出样例:
//5 5 5 2 5 5 5 3 1 3 5#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;const int N = 1010;int n, m;//n个老鼠,m个为一组
int w[N];//老鼠的重量
int ans[N];//存放结果,排名
class Solution {
public:void func() {cin >> n >> m;for (int i = 0; i < n; i++) cin >> w[i];//输入老鼠的重量vector<int> cur(n);//初始化该vector容量为n,上来就可以cur[0],,,cur[n-1]的取,否则不行for (int i = 0; i < n; i++) cin >> cur[i];//输入老鼠的参赛序号while (cur.size() > 1) {vector<int> next;//下一轮参赛的老鼠的需要,11只老鼠3个一组,下一轮是4个,再是2,1//晋级老鼠数量,11只参赛3个一组,最后晋级4组,remain=4,剩余的老鼠共同排名就是4+1=5 第五名int remain = (cur.size() + m - 1) / m;//i是每组的起始下标,j是每组的结束下标for (int i = 0; i < cur.size();){//3只为一组比赛,所以i=i+3,最后的i=j就是这个效果int j = min((int)cur.size(), i + m);//11只,最后一组应该只有两只int t = i;//t用来标记最重的老鼠for (int k = i; k < j; k++) {//遍历本组从i到j,更新t为最重的老鼠if (w[cur[k]] > w[cur[t]]) {t = k;}}next.push_back(cur[t]);//将最重老鼠的序号放入next数组for (int k = i; k < j; k++) {//晋级以外的老鼠,确定排名,放入ans数组,这些老鼠共同排名为晋级老鼠数量+1if (k != t) {ans[cur[k]] = remain + 1;}}i = j;//更新下一比赛组的起点为j,j就是i+m}cur = next;//更新下一个参赛组,为next数组,从11只,更新后变成4只}//上面while循环完了,最后剩余一只老鼠,手动设置排名第一ans[cur[0]] = 1;//最后输出ans中的排名结果,注意pat最后无空格cout << ans[0];for (int i = 1; i < n; i++) cout << ' ' << ans[i];cout << endl;}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟十 1548. 才华与德行 PAT甲级真题1062

1548. 才华与德行

大约 900900 年前,中国哲学家司马光写了一本历史书,其中谈到了人们的才华和德行。

按照他的理论,才华和德行都杰出的人是圣人。

才华一般,德行过人的人是君子。

才华,德行都一般,但是德行胜过才华的人是愚人。

以上都不满足的是小人。

现在,给定每个人的才华和德行,请你根据司马光的理论对他们排名。

输入格式

第一行包含三个整数,N,表示总人数,L,表示合格分数线,仅对才华和德行均不低于此线的那些人进行排名,H,表示优秀分数线。

下面对四种人进行分类:

  1. 才华和德行均不低于 H 的是圣人,圣人们按德才总分不升序排序。
  2. 才华低于 H,德行不低于 H 的是君子,君子们按德才总分不升序排序,他们都低于圣人。
  3. 才华和德行均低于 H,但是德行不低于才华的是愚人,愚人们按德才总分不升序排序,他们都低于君子。
  4. 能够参与排名的,不属于以上三类人的均是小人,小人们按德才总分不升序排序,他们都低于愚人。

接下来 N 行,每行包含一个人的信息,包括一个人的ID,德行,才华。(注意顺序)

ID 是唯一 88 位数字,德行和才华是 [0,100][0,100] 之间的整数。

输出格式

第一行包含整数 M,表示总参与排名的人数。

接下来 M 行,按照排名规则,从前到后输出每个人的信息,每个人占一行。

依次输出所有圣人、君子、愚人和小人。

同一类人之中,如果出现总分相同的情况,则按德行分不升序排名,如果得分完全相同,则按 ID 升序排名。

数据范围

1≤N≤105,
60≤L<H<100

输入样例:

14 60 80
10000001 64 90
10000002 90 60
10000011 85 80
10000003 85 80
10000004 80 85
10000005 82 77
10000006 83 76
10000007 90 78
10000008 75 79
10000009 59 90
10000010 88 45
10000012 80 100
10000013 90 99
10000014 66 60

输出样例:

12
10000013 90 99
10000012 80 100
10000003 85 80
10000011 85 80
10000004 80 85
10000007 90 78
10000006 83 76
10000005 82 77
10000002 90 60
10000014 66 60
10000008 75 79
10000001 64 90

About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and virtue must be a “sage(圣人)”; being less excellent but with one’s virtue outweighs talent can be called a “nobleman(君子)”; being good in neither is a “fool man(愚人)”; yet a fool man is better than a “small man(小人)” who prefers talent than virtue.

Now given the grades of talent and virtue of a group of people, you are supposed to rank them according to Sima Guang’s theory.

Input Specification:

Each input file contains one test case. Each case first gives 3 positive integers in a line: N (<=105), the total number of people to be ranked; L (>=60), the lower bound of the qualified grades — that is, only the ones whose grades of talent and virtue are both not below this line will be ranked; and H (<100), the higher line of qualification — that is, those with both grades not below this line are considered as the “sages”, and will be ranked in non-increasing order according to their total grades. Those with talent grades below H but virtue grades not are cosidered as the “noblemen”, and are also ranked in non-increasing order according to their total grades, but they are listed after the “sages”. Those with both grades below H, but with virtue not lower than talent are considered as the “fool men”. They are ranked in the same way but after the “noblemen”. The rest of people whose grades both pass the L line are ranked after the “fool men”.

Then N lines follow, each gives the information of a person in the format:

ID_Number Virtue_Grade Talent_Grade
where ID_Number is an 8-digit number, and both grades are integers in [0, 100]. All the numbers are separated by a space.
Output Specification:

The first line of output must give M (<=N), the total number of people that are actually ranked. Then M lines follow, each gives the information of a person in the same format as the input, according to the ranking rules. If there is a tie of the total grade, they must be ranked with respect to their virtue grades in non-increasing order. If there is still a tie, then output in increasing order of their ID’s.

Sample Input:

14 60 80
10000001 64 90
10000002 90 60
10000011 85 80
10000003 85 80
10000004 80 85
10000005 82 77
10000006 83 76
10000007 90 78
10000008 75 79
10000009 59 90
10000010 88 45
10000012 80 100
10000013 90 99
10000014 66 60

Sample Output:

12
10000013 90 99
10000012 80 100
10000003 85 80
10000011 85 80
10000004 80 85
10000007 90 78
10000006 83 76
10000005 82 77
10000002 90 60
10000014 66 60
10000008 75 79
10000001 64 90

//1548. 才华与德行
//
//大约 900年前,中国哲学家司马光写了一本历史书,其中谈到了人们的才华和德行。
//
//按照他的理论,才华和德行都杰出的人是圣人。
//
//才华一般,德行过人的人是君子。
//
//才华,德行都一般,但是德行胜过才华的人是愚人。
//
//以上都不满足的是小人。
//
//现在,给定每个人的才华和德行,请你根据司马光的理论对他们排名。
//
//输入格式
//第一行包含三个整数,N,表示总人数,L,表示合格分数线,
//仅对才华和德行均不低于此线的那些人进行排名,H,表示优秀分数线。
//
//下面对四种人进行分类:
//
//才华和德行均不低于 H的是圣人,圣人们按 德才总分 不升序排序。
//才华低于 H,德行不低于 H的是君子,君子们按 德才总分 不升序排序,他们都低于圣人。
//才华和德行均低于 H,但是德行不低于才华的是愚人,愚人们按 德才总分 不升序排序,他们都低于君子。
//能够参与排名的,不属于以上三类人的均是小人,小人们按 德才总分 不升序排序,他们都低于愚人。
//接下来 N行,每行包含一个人的信息,包括一个人的ID,德行,才华。(注意顺序)
//
//ID 是唯一 8位数字,德行和才华是[0, 100]之间的整数。
//
//输出格式
//第一行包含整数 M,表示总参与排名的人数。
//
//接下来 M行,按照排名规则,从前到后输出每个人的信息,每个人占一行。
//
//依次输出所有圣人、君子、愚人和小人。
//
//同一类人之中,如果出现总分相同的情况,则按德行分不升序排名,如果得分完全相同,则按 ID 升序排名。
//
//数据范围
//1≤N≤105,
//60≤L < H < 100
//输入样例:
//14 60 80
//10000001 64 90
//10000002 90 60
//10000011 85 80
//10000003 85 80
//10000004 80 85
//10000005 82 77
//10000006 83 76
//10000007 90 78
//10000008 75 79
//10000009 59 90
//10000010 88 45
//10000012 80 100
//10000013 90 99
//10000014 66 60
//输出样例:
//12
//10000013 90 99
//10000012 80 100
//10000003 85 80
//10000011 85 80
//10000004 80 85
//10000007 90 78
//10000006 83 76
//10000005 82 77
//10000002 90 60
//10000014 66 60
//10000008 75 79
//10000001 64 90#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;
const int N = 100010;
int n, L, H;//总人数,合格分数线,优秀分数线
struct Person{int id;int moral;//德行int talent;//才华int level;//int total() const{return moral + talent;}/*bool operator< (const Person& t) const{if (level != t.level) return level < t.level;if (total() != t.total()) return total() > t.total();if (moral != t.moral) return moral > t.moral;return id < t.id;}*/}p[N];bool cmp(Person a, Person b) {if (a.level != b.level) {return a.level < b.level;}else if (a.total() != b.total()) {return a.total() > b.total();}else if (a.moral != b.moral) {return a.moral > b.moral;}else {return a.id < b.id;}
}class Solution {
public:void func() {//scanf("%d%d%d", &n, &L, &H);cin >> n >> L >> H;//总人数,合格分数线,优秀分数线int m = 0;//Person结构体数组的下标for (int i = 0; i < n; i++) {int id, moral, talent;//id,德行,才华//scanf("%d%d%d", &id, &moral, &talent);cin >> id >> moral >> talent;if (moral < L || talent < L) continue;int level;if (moral >= H && talent >= H) level = 1;else if (moral >= H && talent < H) level = 2;else if (moral < H && talent < H && moral >= talent) level = 3;else level = 4;p[m++] = { id, moral, talent, level };}//sort(p, p + m);//yxc,函数定义在结构体内sort(p, p + m, cmp);//我改成了cmp函数,函数定义在结构体外printf("%d\n", m);for (int i = 0; i < m; i++) {printf("%08d %d %d\n", p[i].id, p[i].moral, p[i].talent);}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟十一 1551. A + B 和 C PAT甲级真题1065

1551. A + B 和 C​​​​​​

给定三个整数 A,B,C请你判断 A+B>C 是否成立。

输入格式

第一行包含整数 T,表示共有 T 组测试数据。

接下来 T 行,每行包含一组数据,即三个整数 A,B,C

输出格式

每行输出一个结果,如果不等式成立,输出 Case #X: true,否则输出 Case #X: false,其中 X 表示数据编号(从 11 开始)。

数据范围

−2^63≤A,B,C≤2^63−1

输入样例:

3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0

输出样例:

Case #1: false
Case #2: true
Case #3: false

Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C.

Input Specification:

The first line of the input gives the positive number of test cases, T (<=10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.

Output Specification:

For each test case, output in one line “Case #X: true” if A+B>C, or “Case #X: false” otherwise, where X is the case number (starting from 1).”

Sample Input:

3
1 2 3
2 3 4
9223372036854775807 -9223372036854775808 0

Sample Output:

Case #1: false
Case #2: true
Case #3: false

分析:因为A、B的大小为[-2^63, 2^63],用long long 存储A和B的值,以及他们相加的值sum:

如果A > 0, B < 0 或者 A < 0, B > 0,sum是不可能溢出的

如果A > 0, B > 0,sum可能会溢出,sum范围理应为(0, 2^64 – 2],溢出得到的结果应该是[-2^63, -2]是个负数,所以sum < 0时候说明溢出了

如果A < 0, B < 0,sum可能会溢出,同理,sum溢出后结果是大于0的,所以sum > 0 说明溢出了

//1551. A + B 和 C
//
//给定三个整数 A, B, C,请你判断 A + B > C是否成立。
//
//输入格式
//第一行包含整数 T,表示共有 T组测试数据。
//
//接下来 T行,每行包含一组数据,即三个整数 A, B, C。
//
//输出格式
//每行输出一个结果,如果不等式成立,输出 Case #X: true,
//否则输出 Case #X : false,其中 X表示数据编号(从 1开始)。
//
//数据范围
//−2^63≤A, B, C≤2^63−1
//
//输入样例:
//3
//1 2 3
//2 3 4
//9223372036854775807 - 9223372036854775808 0
//
//输出样例:
//Case #1: false
//Case #2: true
//Case #3: false#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;class Solution {
public:typedef long long LL;bool check(LL a, LL b, LL c){LL d = a + b;if (a >= 0 && b >= 0 && d < 0) return true;if (a < 0 && b < 0 && d >= 0) return false;return a + b > c;}void func() {int n;cin >> n;for (int i = 1; i <= n; i++){LL a, b, c;//scanf("%lld%lld%lld", &a, &b, &c);cin >> a >> b >> c;//这里换成cin,pat就有一个测试不通过了!!if (check(a, b, c)) printf("Case #%d: true\n", i);else printf("Case #%d: false\n", i);}}
};//柳神
class Solution2 {
public:void func() {int n;//scanf("%d", &n);cin >> n;for (int i = 0; i < n; i++) {long long a, b, c;//scanf("%lld %lld %lld", &a, &b, &c);cin >> a >> b >> c;//这里换成cin,pat就有一个测试不通过了!!long long sum = a + b;if (a > 0 && b > 0 && sum < 0) {printf("Case #%d: true\n", i + 1);}else if (a < 0 && b < 0 && sum >= 0) {printf("Case #%d: false\n", i + 1);}else if (sum > c) {printf("Case #%d: true\n", i + 1);}else {printf("Case #%d: false\n", i + 1);}}}
};int main() {Solution s;s.func();return 0;
}

十一模拟十2 1555. 数字黑洞 PAT甲级真题1069

1555. 数字黑洞

对于任何各位数字不完全相同的四位整数,我们将该数字的四个数位按非升序排列,得到一个数字,再按非降序排列,得到另一个数字,将两个数字相减就能得到一个新的数字。

不断重复这个过程,我们就能得到数字6174 ---- 这是四位数字的黑洞。

例如,给定数字 6767,过程如下:

7766 - 6677 = 1089
9810 - 0189 = 9621
9621 - 1269 = 8352
8532 - 2358 = 6174
7641 - 1467 = 6174
... ...

给定任意一个四位数字,请你输出它进入黑洞的过程。

输入格式

包含一个正整数 N。

注意,给定数字 N 如果不足四位,则补充前导 00 至四位为止。

输出格式

如果 N 的四位数字都相同,则输出一行 N - N = 0000

否则,每行输出一个操作步骤,直到出现 61746174 作为差值产生为止。

所有数字都必须输出为四位数字。

数据范围

0<N<10000

输入样例1:

6767

输出样例1:

7766 - 6677 = 1089
9810 - 0189 = 9621
9621 - 1269 = 8352
8532 - 2358 = 6174

输入样例2:

2222

输出样例2:

2222 - 2222 = 0000

For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking the second number from the first one. Repeat in this manner we will soon end up at the number 6174 -- the "black hole" of 4-digit numbers. This number is named Kaprekar Constant.

For example, start from 6767, we'll get:

7766 - 6677 = 1089
9810 - 0189 = 9621
9621 - 1269 = 8352
8532 - 2358 = 6174
7641 - 1467 = 6174
... ...

Given any 4-digit number, you are supposed to illustrate the way it gets into the black hole.

Input Specification:

Each input file contains one test case which gives a positive integer N in the range (0, 10000).

Output Specification:

If all the 4 digits of N are the same, print in one line the equation "N - N = 0000". Else print each step of calculation in a line until 6174 comes out as the difference. All the numbers must be printed as 4-digit numbers.

Sample Input 1:
6767

Sample Output 1:
7766 - 6677 = 1089
9810 - 0189 = 9621
9621 - 1269 = 8352
8532 - 2358 = 6174

Sample Input 2:
2222

Sample Output 2:

2222 - 2222 = 0000

分析:有一个测试用例注意点,如果当输入N值为6174的时候,依旧要进行下面的步骤,直到差值为6174才可以~所以用do while语句,无论是什么值总是要执行一遍while语句,直到遇到差值是0000或6174~

s.insert(0, 4 – s.length(), ‘0’);用来给不足4位的时候前面补0~

//1555. 数字黑洞
//
//对于任何各位数字不完全相同的 四位整数,我们将该数字的四个数位按 非升序(递减) 排列,
//得到一个数字,再按非降序排列,得到另一个数字,将两个数字 相减 就能得到一个新的数字。
//
//不断重复这个过程,我们就能得到数字6174----这是四位数字的黑洞。
//
//例如,给定数字 6767,过程如下:
//
//7766 - 6677 = 1089
//9810 - 0189 = 9621
//9621 - 1269 = 8352
//8532 - 2358 = 6174
//7641 - 1467 = 6174
//... ...
//给定任意一个四位数字,请你输出它进入黑洞的过程。
//
//输入格式
//包含一个正整数 N。
//
//注意,给定数字 N如果不足四位,则补充前导 0至四位为止。
//
//输出格式
//如果 N的四位数字都相同,则输出一行 N - N = 0000。
//
//否则,每行输出一个操作步骤,直到出现 6174作为差值产生为止。
//
//所有数字都必须输出为四位数字。
//
//数据范围
//0 < N < 10000
//输入样例1:
//6767
//输出样例1:
//7766 - 6677 = 1089
//9810 - 0189 = 9621
//9621 - 1269 = 8352
//8532 - 2358 = 6174
//
//输入样例2:
//2222
//输出样例2:
//2222 - 2222 = 0000#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;//网友
class Solution {
public:void func() {int n, a, b, c, d, m, l;cin >> n;while (true) {a = n % 10;b = n / 10 % 10;c = n / 100 % 10;d = n / 1000;if (a > b)swap(a, b);if (a > c)swap(a, c);if (a > d)swap(a, d);if (b > c)swap(b, c);if (b > d)swap(b, d);if (c > d)swap(c, d);m = d * 1000 + c * 100 + b * 10 + a * 1;l = a * 1000 + b * 100 + c * 10 + d * 1;n = m - l;a = m % 10;b = m / 10 % 10;c = m / 100 % 10;d = m / 1000;cout << d << c << b << a << " - ";a = l % 10;b = l / 10 % 10;c = l / 100 % 10;d = l / 1000;cout << d << c << b << a << " = ";a = n % 10;b = n / 10 % 10;c = n / 100 % 10;d = n / 1000;cout << d << c << b << a << endl;if (n == 6174 || m == l) return;}}
};//YXC
class Solution2 {
public:vector<int> get(int n){int nums[4];for (int i = 0; i < 4; i++){nums[i] = n % 10;n /= 10;}sort(nums, nums + 4);int a = 0;for (int i = 0; i < 4; i++) a = a * 10 + nums[i];reverse(nums, nums + 4);int b = 0;for (int i = 0; i < 4; i++) b = b * 10 + nums[i];return { b, a };}void func() {int n;cin >> n;//如果上来直接输入6174,也要执行一遍,所以要do while先执行do{auto t = get(n);//%04d是 不足4位,用0补足4位printf("%04d - %04d = %04d\n", t[0], t[1], t[0] - t[1]);n = t[0] - t[1];} while (n!=0 && n != 6174);}
};//柳
bool cmp(char a, char b) { return a > b; }
class Solution3 {
public:void func() {string s;cin >> s;s.insert(0, 4 - s.length(), '0');do {string a = s, b = s;sort(a.begin(), a.end(), cmp);sort(b.begin(), b.end());int result = stoi(a) - stoi(b);s = to_string(result);s.insert(0, 4 - s.length(), '0');cout << a << " - " << b << " = " << s << endl;} while (s != "6174" && s != "0000");}
};int main() {Solution s;s.func();return 0;
}

十一模拟十3  1566. 研究生入学 PAT甲级真题1080

1566. 研究生入学

据说,20112011 年,浙江省约有 100100 所研究生院准备着手处理 40,00040,000 多份入学申请。

如果你可以编写一个程序来自动执行录取流程,那将会很有帮助。

每个申请人都必须提供两个成绩:全国入学考试成绩 GE 和面试成绩 GI,申请人的最终成绩是 (GE+GI)/2。

录取规则如下:

  • 申请者将根据其最终成绩由高到低进行排名,并且将从排名列表的顶部开始逐一录取。
  • 如果申请者的最终成绩并列,则按照 GE成绩由高到低进行排名,如果成绩仍然并列,则并列者的排名必须相同。
  • 每个申请人可以填报 K 个志愿,并且将根据他/她的志愿进行录取:如果按照排名列表,轮到某位学生被录取了,并且其第一志愿学校还未招满人,则他成功被该学校录取。如果名额已满,则按顺序考虑其他志愿,直至成功被录取为止。如果所有报名学校都无法录取该名学生,则该名学生录取失败。
  • 如果出现并列排名,并且并列申请人正在申请同一所学校,那么该学校不得只录取其中一部分申请人,即使超过招生限额,也必须全部录取。

输入格式

第一行包含三个整数,N 表示总申请人数量,M 表示学校数量,K 表示可填报志愿数量。

第二行包含 M个整数,表示每所学校的计划招生人数。

接下来 N 行,每行包含 2+K2 个整数,前两个整数表示一名申请人的 GE和 GI,接下来 K� 个整数,表示该申请人的志愿学校编号。

所有学校编号 0∼M−1,所有申请人编号 0∼N−1。

输出格式

输出所有研究生院的录取结果。

每所学校的录取结果占据一行,其中包含所有学校录取的申请人的编号。编号必须按升序排列,并用空格分隔。

每行的末尾必须没有多余的空格。

如果某学校没有录取任何学生,则必须相应地输出空白行。

数据范围

1≤N≤≤40000,
1≤M≤100,
1≤K≤5,
0≤GE,GI≤1≤100,
每所学校的计划招生人数不会超过 2000。

输入样例:

11 6 3
2 1 2 2 2 3
100 100 0 1 2
60 60 2 3 5
100 90 0 3 4
90 100 1 2 0
90 90 5 1 3
80 90 1 0 2
80 80 0 1 2
80 80 0 1 2
80 70 1 3 2
70 80 1 2 3
100 100 0 2 4

输出样例:

0 10
3
5 6 7
2 81 4

It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission procedure.

Each applicant will have to provide two grades: the national entrance exam grade GE, and the interview grade GI. The final grade of an applicant is (GE + GI) / 2. The admission rules are:

The applicants are ranked according to their final grades, and will be admitted one by one from the top of the rank list.
If there is a tied final grade, the applicants will be ranked according to their national entrance exam grade GE. If still tied, their ranks must be the same.
Each applicant may have K choices and the admission will be done according to his/her choices: if according to the rank list, it is one's turn to be admitted; and if the quota of one's most preferred shcool is not exceeded, then one will be admitted to this school, or one's other choices will be considered one by one in order. If one gets rejected by all of preferred schools, then this unfortunate applicant will be rejected.
If there is a tied rank, and if the corresponding applicants are applying to the same school, then that school must admit all the applicants with the same rank, even if its quota will be exceeded.

Input Specification:

Each input file contains one test case. Each case starts with a line containing three positive integers: N (<=40,000), the total number of applicants; M (<=100), the total number of graduate schools; and K (<=5), the number of choices an applicant may have.

In the next line, separated by a space, there are M positive integers. The i-th integer is the quota of the i-th graduate school respectively.

Then N lines follow, each contains 2+K integers separated by a space. The first 2 integers are the applicant's GE and GI, respectively. The next K integers represent the preferred schools. For the sake of simplicity, we assume that the schools are numbered from 0 to M-1, and the applicants are numbered from 0 to N-1.

Output Specification:

For each test case you should output the admission results for all the graduate schools. The results of each school must occupy a line, which contains the applicants' numbers that school admits. The numbers must be in increasing order and be separated by a space. There must be no extra space at the end of each line. If no applicant is admitted by a school, you must output an empty line correspondingly.

Sample Input:
11 6 3
2 1 2 2 2 3
100 100 0 1 2
60 60 2 3 5
100 90 0 3 4
90 100 1 2 0
90 90 5 1 3
80 90 1 0 2
80 80 0 1 2
80 80 0 1 2
80 70 1 3 2
70 80 1 2 3
100 100 0 2 4

Sample Output:
0 10
3
5 6 7
2 8

1 4

//1566. 研究生入学
//
//据说,2011年,浙江省约有 100所研究生院准备着手处理 40, 000多份入学申请。
//
//如果你可以编写一个程序来自动执行录取流程,那将会很有帮助。
//
//每个申请人都必须提供两个成绩:全国入学考试成绩 GE和面试成绩 GI,
//申请人的最终成绩是(GE + GI) / 2。
//
//录取规则如下:
//
//申请者将根据其最终成绩由高到低进行排名,并且将从排名列表的顶部开始逐一录取。
//如果申请者的最终成绩并列,则按照 GE成绩由高到低进行排名,如果成绩仍然并列,则并列者的排名必须相同。
//每个申请人可以填报 K个志愿,并且将根据他 / 她的志愿进行录取:如果按照排名列表,轮到某位学生被录取了,
//并且其第一志愿学校还未招满人,
//则他成功被该学校录取。如果名额已满,则按顺序考虑其他志愿,直至成功被录取为止。
//如果所有报名学校都无法录取该名学生,则该名学生录取失败。
//如果出现并列排名,并且并列申请人正在申请同一所学校,
//那么该学校不得只录取其中一部分申请人,即使超过招生限额,也必须全部录取。
//
//输入格式
//第一行包含三个整数,N
//表示总申请人数量,M
//表示学校数量,K
//表示可填报志愿数量。
//
//第二行包含 M个整数,表示每所学校的计划招生人数。
//
//接下来 N行,每行包含 2 + K个整数,前两个整数表示一名申请人的 GE和 GI,接下来 K个整数,
//表示该申请人的志愿学校编号。
//
//所有学校编号 0∼M−1,所有申请人编号 0∼N−1。
//
//输出格式
//输出所有研究生院的录取结果。
//
//每所学校的录取结果占据一行,其中包含所有学校录取的申请人的编号。编号必须按升序排列,并用空格分隔。
//
//每行的末尾必须没有多余的空格。
//
//如果某学校没有录取任何学生,则必须相应地输出空白行。
//
//数据范围
//1≤N≤40000,
//1≤M≤100,
//1≤K≤5,
//0≤GE, GI≤100,
//每所学校的计划招生人数不会超过 2000。
//
//输入样例:
//11 6 3
//2 1 2 2 2 3
//100 100 0 1 2
//60 60 2 3 5
//100 90 0 3 4
//90 100 1 2 0
//90 90 5 1 3
//80 90 1 0 2
//80 80 0 1 2
//80 80 0 1 2
//80 70 1 3 2
//70 80 1 2 3
//100 100 0 2 4
//
//输出样例:
//0 10
//3
//5 6 7
//2 8
//
//1 4#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;//4W同学,100所学校,每人5个志愿
const int N = 40010, M = 110, K = 5;int n, m, k;//N表示总申请人数量,M表示学校数量,K表示可填报志愿数量。
int cnt[N];//每个学校名额数量
int wish[N];//wish[1]=2代表1号同学最终被2号学校录取
vector<int> uty[M];//每个学校实际招的人数,不得超过cnt[N](学校招生名额)struct Person
{int id, ge, gi;//id,笔试成绩,面试成绩int wish[K];//志愿//求总分//要在比较函数中调用,比较函数是const,所以这里也const,const是不对任何变量做修改int total() const{return ge + gi;}bool operator< (const Person& t) const{//先按照总分比,返回总分较大的,总分大的排前面if (total() != t.total()) return total() > t.total();//总分相同,就按照笔试成绩排,高分的在前面return ge > t.ge;}//重载等号,笔试面试都相等 bool operator== (const Person& t) const{return ge == t.ge && gi == t.gi;}
}p[N];
//我写的cmp,和上面的一样效果!可通过
bool cmp(Person a, Person b) {if (a.total() != b.total()) {return a.total() > b.total();}else {return a.ge > b.ge;}
}
class Solution {
public:void func() {//因为数量比较大,40000的学生,5个志愿,乘起来有20W,数字大,用scanf比cin快! //N表示总申请人数量,M表示学校数量,K表示可填报志愿数量。11,6,3scanf("%d%d%d", &n, &m, &k);//读入每所学校的计划招生人数,名额,2 1 2 2 2 3for (int i = 0; i < m; i++) scanf("%d", &cnt[i]);//输入学生,放在结构体中for (int i = 0; i < n; i++){p[i].id = i;//学生id 就是下标iscanf("%d%d", &p[i].ge, &p[i].gi);//输入学生笔试成绩,面试成绩//读入志愿,因为k=3,所以有3个志愿,因为6个学校,所以志愿是0-5,代表6个学校for (int j = 0; j < k; j++) {scanf("%d", &p[i].wish[j]);}}//对所有同学排序,排序方法见上面,按成绩排序//sort(p, p + n);sort(p, p + n, cmp);//memset(wish, -1, sizeof wish);//用fill代替menset初始化 ,fill(aa.begin(), aa.end(), 2);//-1代表不能报该学校,全是-1代表啥学校都不能报,就是初始化fill(wish, wish+N, -1); //遍历每个同学for (int i = 0; i < n;){int j = i + 1;//重载了等号的作用,实际上就是比较二者笔试成绩,面试成绩都相同,就j++,找到不同的while (j < n && p[i] == p[j]) {//从i到j是 同一个分数段的同学j++;}//这里是同一分数的同学,从i到j,如果有3个学生(编号1,2,3),//且3个学生都报了0号学校,而0号学校只有一个名额//此时,3次遍历,uty[0],size()一直是0,所以cnt[0]>uty[0].size()一直成立,//wish[1],wish[2],wish[3]都等于w=0,也就是说3个人都被0号大学录取了//而再后面的for,才执行uty[wish[t]],也就是uty[0].push_back(p[t].id);//此时uty[0].size()才增加3,也就是都录取了,才增加整个size//使得哪怕招生名额只有1个,同一分数的学生3个都被录取的逻辑实现了for (int t = i; t < j; t++)//遍历这同一分数的同学for (int u = 0; u < k; u++)//u为0到k-1,就是k个志愿里的第u个志愿吧{int w = p[t].wish[u];//第k个同学的第u个志愿存(是报考哪个学校)下来,存入w,w是学校编号if (cnt[w] > uty[w].size())//如果第w学校的名额大于w学校当前已招的人数,即还有名额{wish[t] = w;//t这位同学就考上了w号学校break;//剩下的志愿就不用遍历了,跳出,去遍历下一位同学}}for (int t = i; t < j; t++) {//遍历这同一分数的同学if (wish[t] != -1) {//t同学的志愿(即学校编号wish[t])不是-1,能录取uty[wish[t]].push_back(p[t].id);//该学校加入t同学的id}}i = j;//i=j则开始下一波同一分数学生的遍历}//遍历m个学校(也是m种志愿)for (int i = 0; i < m; i++){if (uty[i].size()){//该学校有招到学生,nty[i]就是第i号学校sort(uty[i].begin(), uty[i].end());//输出,防末尾空格printf("%d", uty[i][0]);for (int j = 1; j < uty[i].size(); j++)printf(" %d", uty[i][j]);}puts("");}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟十4 1569. 成绩单 PAT甲级真题1083

1569. 成绩单

给定一个包含 N 名学生的姓名,ID,成绩的列表。

请你将表单按照学生成绩由高到低进行排序,并输出成绩在给定间隔内的所有学生信息。

输入格式

输入格式如下:

N
name[1] ID[1] grade[1]
name[2] ID[2] grade[2]
... ...
name[N] ID[N] grade[N]
grade1 grade2

其中 name[i] 和 ID[i] 是长度不超过 1010 的不含空格的字符串,grade[i] 是在 [0,100][0,100] 范围内的整数。

grade1 和 grade2 是查询成绩区间的左右边界。

保证所有学生的成绩互不相同。

输出格式

按成绩由高到低的顺序,输出所有成绩在 [grade1,grade2] 之间的学生信息。

输出信息包括学生姓名和ID。

如果区间内不存在任何学生,则输出 NONE

数据范围

1≤N≤101

输入样例1:

4
Tom CS000001 59
Joe Math990112 89
Mike CS991301 100
Mary EE990830 95
60 100

输出样例1:

Mike CS991301
Mary EE990830
Joe Math990112

输入样例2:

2
Jean AA980920 60
Ann CS01 80
90 95

输出样例2:

NONE

Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades are in a given interval.

Input Specification:

Each input file contains one test case. Each case is given in the following format:

N
name[1] ID[1] grade[1]
name[2] ID[2] grade[2]
… …
name[N] ID[N] grade[N]
grade1 grade2
where name[i] and ID[i] are strings of no more than 10 characters with no space, grade[i] is an integer in [0, 100], grade1 and grade2 are the boundaries of the grade’s interval. It is guaranteed that all the grades are distinct.

Output Specification:

For each test case you should output the student records of which the grades are in the given interval [grade1, grade2] and are in non-increasing order. Each student record occupies a line with the student’s name and ID, separated by one space. If there is no student’s grade in that interval, output “NONE” instead.

Sample Input 1:

4
Tom CS000001 59
Joe Math990112 89
Mike CS991301 100
Mary EE990830 95
60 100

Sample Output 1:
Mike CS991301
Mary EE990830
Joe Math990112

Sample Input 2:

2
Jean AA980920 60
Ann CS01 80
90 95

Sample Output 2:

NONE

//1569. 成绩单
//
//给定一个包含 N名学生的姓名,ID,成绩的列表。
//
//请你将表单按照学生成绩由高到低进行排序,并输出成绩在给定间隔内的所有学生信息。
//
//输入格式
//输入格式如下:
//
//N
//name[1] ID[1] grade[1]
//name[2] ID[2] grade[2]
//... ...
//name[N] ID[N] grade[N]
//grade1 grade2
//其中 name[i] 和 ID[i] 是长度不超过 10的不含空格的字符串,grade[i] 是在[0, 100]范围内的整数。
//
//grade1 和 grade2 是查询成绩区间的左右边界。
//
//保证所有学生的成绩互不相同。
//
//输出格式
//按成绩由高到低的顺序,输出所有成绩在[grade1, grade2] 之间的学生信息。
//
//输出信息包括学生姓名和ID。
//
//如果区间内不存在任何学生,则输出 NONE。
//
//数据范围
//1≤N≤101
//输入样例1:
//4
//Tom CS000001 59
//Joe Math990112 89
//Mike CS991301 100
//Mary EE990830 95
//60 100
//输出样例1:
//Mike CS991301
//Mary EE990830
//Joe Math990112
//
//输入样例2:
//2
//Jean AA980920 60
//Ann CS01 80
//90 95
//输出样例2:
//NONE#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;
const int N = 110;//yxc
struct Person
{string name, id;int grade;bool operator< (const Person& t) const{return grade > t.grade;}
}p[N];
//我写的cmp
bool cmp(Person a, Person b) {return a.grade > b.grade;
}
class Solution {
public:int n;void func() {cin >> n;for (int i = 0; i < n; i++) cin >> p[i].name >> p[i].id >> p[i].grade;int g1, g2;cin >> g1 >> g2;int m = 0;for (int i = 0; i < n; i++){if (p[i].grade >= g1 && p[i].grade <= g2) {p[m++] = p[i];//直接就放在p[N]数组里了,也没有新建一个}}if (!m) puts("NONE");else{sort(p, p + m);for (int i = 0; i < m; i++)cout << p[i].name << ' ' << p[i].id << endl;}}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}

十一模拟十5 1582. 买还是不买 PAT甲级真题1092

1582. 买还是不买

伊娃需要若干颜色的若干珠子来制作一条她喜欢的手链。

因此,她去往一家小商店购买珠子。

商店里的珠子都是一整串串起的,里面包含各种颜色的珠子。

已知,商店每串珠子都不拆开售卖,只能整串购买。

伊娃想知道如果她购买一串商店的珠子,里面能否包含她需要的所有珠子。

如果能包含她需要的所有珠子,则回答 Yes,并输出她购买的多余的珠子的数量。

如果不能包含她需要的所有珠子,则回答 No,并输出她还缺少的珠子的数量。

为了简单起见,我们用数字 0∼90∼9,以及大小写字母 A∼Z,a∼z 来表示珠子的颜色。

例如,下图中的第三串珠子就是伊娃想要串成的成品。

那么购买第一串珠子就可以达成目的,因为它包含了所有必要的珠子以及 88 个多余的珠子。

但是购买第二串珠子就不行,因为里面没有黑色珠子,并且少了一个红色珠子。

输入格式

共两行,第一行包含一个字符串表示商店的珠子串。

第二行包含一个字符串表示伊娃想要串成的珠子串。

输出格式

输出共一行。

如果能包含她需要的所有珠子,则回答 Yes,并输出她购买的多余的珠子的数量。

如果不能包含她需要的所有珠子,则回答 No,并输出她还缺少的珠子的数量。

回答和数量之间用一个空格隔开。

数据范围

两个字符串的长度都不超过 10001000。

输入样例1:

ppRYYGrrYBR2258
YrR8RrY

输出样例1:

Yes 8

输入样例2:

ppRYYGrrYB225
YrR8RrY

输出样例2:

No 2

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sell the strings in whole pieces. Hence Eva must check whether a string in the shop contains all the beads she needs. She now comes to you for help: if the answer is “Yes”, please tell her the number of extra beads she has to buy; or if the answer is “No”, please tell her the number of beads missing from the string.

For the sake of simplicity, let us use the characters in the ranges [0-9], [a-z], and [A-Z] to represent the colors. For example, the 3rd string in Figure 1 is the one that Eva would like to make. Then the 1st string is okay since it contains all the necessary beads with 8 extra ones; yet the 2nd one is not since there is no black bead and one less red bead.

Input Specification:

Each input file contains one test case. Each case gives in two lines the strings of no more than 1000 beads which belong to the shop owner and Eva, respectively.

Output Specification:

For each test case, print your answer in one line. If the answer is “Yes”, then also output the number of extra beads Eva has to buy; or if the answer is “No”, then also output the number of beads missing from the string. There must be exactly 1 space between the answer and the number.

Sample Input 1:

ppRYYGrrYBR2258
YrR8RrY

Sample Output 1:

Yes 8

Sample Input 2:

ppRYYGrrYB225
YrR8RrY

Sample Output 1:

No 2

//1582. 买还是不买
//
//伊娃需要若干颜色的若干珠子来制作一条她喜欢的手链。
//
//因此,她去往一家小商店购买珠子。
//
//商店里的珠子都是一整串串起的,里面包含各种颜色的珠子。
//
//已知,商店每串珠子都不拆开售卖,只能整串购买。
//
//伊娃想知道如果她购买一串商店的珠子,里面能否包含她需要的所有珠子。
//
//如果能包含她需要的所有珠子,则回答 Yes,并输出她购买的多余的珠子的数量。
//
//如果不能包含她需要的所有珠子,则回答 No,并输出她还缺少的珠子的数量。
//
//为了简单起见,我们用数字 0∼9,以及大小写字母 A∼Z, a∼z来表示珠子的颜色。
//
//例如,下图中的第三串珠子就是伊娃想要串成的成品。
//
//那么购买第一串珠子就可以达成目的,因为它包含了所有必要的珠子以及 8个多余的珠子。
//
//但是购买第二串珠子就不行,因为里面没有黑色珠子,并且少了一个红色珠子。
//
//b7e2ffa6 - 8819 - 436d - ad79 - a41263abe914.jpg
//
//输入格式
//共两行,第一行包含一个字符串表示商店的珠子串。
//
//第二行包含一个字符串表示伊娃想要串成的珠子串。
//
//输出格式
//输出共一行。
//
//如果能包含她需要的所有珠子,则回答 Yes,并输出她购买的多余的珠子的数量。
//
//如果不能包含她需要的所有珠子,则回答 No,并输出她还缺少的珠子的数量。
//
//回答和数量之间用一个空格隔开。
//
//数据范围
//两个字符串的长度都不超过 1000。
//
//输入样例1:
//ppRYYGrrYBR2258
//YrR8RrY
//输出样例1:
//Yes 8
//
//输入样例2:
//ppRYYGrrYB225
//YrR8RrY
//输出样例2:
//No 2#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;//我法,和yxc思路一样,过
unordered_map<char, int> mp;
class Solution {
public:void func() {//比如a=abcde,b=ab,则最后mp里面是a=0,b=0,c=1,d=1,e=1string a, b;cin >> a >> b;for (int i = 0; i < a.size(); i++) {mp[a[i]]++;}for (int i = 0; i < b.size(); i++) {mp[b[i]]--;}int t = 0;//t是缺失多少珠子int k = 0;//k是剩余多少珠子for (unordered_map<char, int>::iterator it = mp.begin(); it != mp.end(); it++) {if (it->second < 0) {t = t + it->second;}if (it -> second > 0) {k = k + it->second;}}if (t < 0) {printf("No %d\n", -t);}else {printf("Yes %d\n", k);}}
};class Solution2 {
public:void func() {string a, b;cin >> a >> b;unordered_map<char, int> S;for (auto c : a) S[c] ++;for (auto c : b) S[c] --;int sp = 0, sn = 0;for (auto item : S)if (item.second > 0) sp += item.second;else sn -= item.second;if (sn) printf("No %d\n", sn);else printf("Yes %d\n", sp);}
};int main() {Solution s;s.func();return 0;
}

十一模拟十6 1585. 校园内的汽车 PAT甲级真题1095

1585. 校园内的汽车

浙江大学有 88 个校区和许多大门。

从每个大门处我们都可以收集到进出这个大门的汽车的车牌号以及具体进出时间。

现在,给定你所有的有用信息,你需要做的是:

  1. 对于一些查询,计算出查询时刻校园内的汽车数量。
  2. 在一天结束时,找到在校园内停放时间最长的汽车。

输入格式

第一行包含两个整数,N 表示记录数量,K 表示查询时刻数量。

接下来 N 行,每行包含一条记录信息,格式如下:

plate_number hh:mm:ss status

plate_number(车牌号)是一个长度为 77 的只包含大写字母和数字的字符串,hh:mm:ss以 小时:分钟:秒 表示一天中的时间点,最早的时间为 00:00:00,最晚的时间为 23:59:59status(状态)为 in 或 out

注意,所有记录都在一天内产生。

每个 in 记录都与按时间顺序排列的同一辆车的下一条记录配对,但前提是这条记录是 out

所有未与 out 记录配对的 in 记录以及未与 in 记录配对的 out 记录都必须忽略。

确保至少有一辆汽车能够成功配对,不会出现一辆车在同一时刻又进又出的情况。

使用24小时制记录时间。

接下来 K 行,每行包含一个查询时刻,形如 hh:mm:ss

注意,查询时刻是按时间升序给出的。

输出格式

对于每个查询,请在一行中输出校园内停车的汽车总数。

注意:对于每个查询的时刻,先处理在该时刻所有的车辆进出事件,处理完之后再统计停在校园内的汽车数量。

输出的最后一行应给出停车时间最长的汽车的车牌号,以及相应的时间长度。

如果这样的汽车不唯一,则按照字典序依次输出所有车牌号,然后输出相应的时间长度,车牌号以及时间之间用空格隔开。

数据范围

1≤N≤10^4,
1≤K≤8×10^4

输入样例:

16 7
JH007BD 18:00:01 in
ZD00001 11:30:08 out
DB8888A 13:00:00 out
ZA3Q625 23:59:50 out
ZA133CH 10:23:00 in
ZD00001 04:09:59 in
JH007BD 05:09:59 in
ZA3Q625 11:42:01 out
JH007BD 05:10:33 in
ZA3Q625 06:30:50 in
JH007BD 12:23:42 out
ZA3Q625 23:55:00 in
JH007BD 12:24:23 out
ZA133CH 17:11:22 out
JH007BD 18:07:01 out
DB8888A 06:30:50 in
05:10:00
06:30:50
11:00:00
12:23:42
14:00:00
18:00:00
23:59:00

输出样例:

1
4
5
2
1
0
1
JH007BD ZD00001 07:20:09

Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the information available, you are supposed to tell, at any specific time point, the number of cars parking on campus, and at the end of the day find the cars that have parked for the longest time period.

Input Specification:

Each input file contains one test case. Each case starts with two positive integers N (<= 10000), the number of records, and K (<= 80000) the number of queries. Then N lines follow, each gives a record in the format

plate_number hh:mm:ss status

where plate_number is a string of 7 English capital letters or 1-digit numbers; hh:mm:ss represents the time point in a day by hour:minute:second, with the earliest time being 00:00:00 and the latest 23:59:59; and status is either in or out.

Note that all times will be within a single day. Each "in" record is paired with the chronologically next record for the same car provided it is an "out" record. Any "in" records that are not paired with an "out" record are ignored, as are "out" records not paired with an "in" record. It is guaranteed that at least one car is well paired in the input, and no car is both "in" and "out" at the same moment. Times are recorded using a 24-hour clock.

Then K lines of queries follow, each gives a time point in the format hh:mm:ss. Note: the queries are given in ascending order of the times.

Output Specification:

For each query, output in a line the total number of cars parking on campus. The last line of output is supposed to give the plate number of the car that has parked for the longest time period, and the corresponding time length. If such a car is not unique, then output all of their plate numbers in a line in alphabetical order, separated by a space.

Sample Input:
16 7
JH007BD 18:00:01 in
ZD00001 11:30:08 out
DB8888A 13:00:00 out
ZA3Q625 23:59:50 out
ZA133CH 10:23:00 in
ZD00001 04:09:59 in
JH007BD 05:09:59 in
ZA3Q625 11:42:01 out
JH007BD 05:10:33 in
ZA3Q625 06:30:50 in
JH007BD 12:23:42 out
ZA3Q625 23:55:00 in
JH007BD 12:24:23 out
ZA133CH 17:11:22 out
JH007BD 18:07:01 out
DB8888A 06:30:50 in
05:10:00
06:30:50
11:00:00
12:23:42
14:00:00
18:00:00
23:59:00

Sample Output:
1
4
5
2
1
0
1
JH007BD ZD00001 07:20:09

//1585. 校园内的汽车
//浙江大学有 8个校区和许多大门。
//
//从每个大门处我们都可以收集到进出这个大门的汽车的车牌号以及具体进出时间。
//
//现在,给定你所有的有用信息,你需要做的是:
//
//对于一些查询,计算出查询时刻校园内的汽车数量。
//在一天结束时,找到在校园内停放时间最长的汽车。
//
//输入格式
//第一行包含两个整数,N表示记录数量,K表示查询时刻数量。
//
//接下来 N行,每行包含一条记录信息,格式如下:
//
//plate_number hh : mm:ss status
//plate_number(车牌号)是一个长度为 7的只包含大写字母和数字的字符串,
//hh : mm : ss以 小时 : 分钟:秒 表示一天中的时间点,最早的时间为 00 : 00 : 00,最晚的时间为 23 : 59 : 59,
//status(状态)为 in 或 out。
//
//注意,所有记录都在一天内产生。
//
//每个 in 记录都与按时间顺序排列的同一辆车的下一条记录配对,但前提是这条记录是 out。
//
//所有未与 out 记录配对的 in 记录以及未与 in 记录配对的 out 记录都必须忽略。
//
//确保至少有一辆汽车能够成功配对,不会出现一辆车在同一时刻又进又出的情况。
//
//使用24小时制记录时间。
//
//接下来 K行,每行包含一个查询时刻,形如 hh : mm:ss。
//
//注意,查询时刻是按时间升序给出的。
//
//输出格式
//对于每个查询,请在一行中输出校园内停车的汽车总数。
//
//注意:对于每个查询的时刻,先处理在该时刻所有的车辆进出事件,处理完之后再统计停在校园内的汽车数量。
//
//输出的最后一行应给出停车时间最长的汽车的车牌号,以及相应的时间长度。
//
//如果这样的汽车不唯一,则按照字典序依次输出所有车牌号,然后输出相应的时间长度,车牌号以及时间之间用空格隔开。
//
//数据范围
//1≤N≤104,
//1≤K≤8×104
//输入样例:
//16 7
//JH007BD 18:00 : 01 in
//ZD00001 11 : 30 : 08 out
//DB8888A 13:00 : 00 out
//ZA3Q625 23 : 59 : 50 out
//ZA133CH 10 : 23 : 00 in
//ZD00001 04 : 09 : 59 in
//JH007BD 05 : 09 : 59 in
//ZA3Q625 11 : 42 : 01 out
//JH007BD 05 : 10 : 33 in
//ZA3Q625 06 : 30 : 50 in
//JH007BD 12 : 23 : 42 out
//ZA3Q625 23 : 55 : 00 in
//JH007BD 12 : 24 : 23 out
//ZA133CH 17 : 11 : 22 out
//JH007BD 18 : 07 : 01 out
//DB8888A 06 : 30 : 50 in
//05 : 10 : 00
//06 : 30 : 50
//11 : 00 : 00
//12 : 23 : 42
//14 : 00 : 00
//18 : 00 : 00
//23 : 59 : 00
//输出样例:
//1
//4
//5
//2
//1
//0
//1
//JH007BD ZD00001 07:20 : 09#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<algorithm>
#include<deque>
#include <math.h>
#include<cstdio>
using namespace std;struct Event
{int tm;//时间int status;//状态//按照实际从小到大排bool operator< (const Event& t) const{return tm < t.tm;}
};
bool cmp(Event a, Event b) {return a.tm < b.tm;
}int get(vector<Event>& ets)
{int res = 0;for (int i = 0; i < ets.size(); i += 2)res += ets[i + 1].tm - ets[i].tm;return res;
}class Solution {
public:void func() {int n, m;//N表示记录数量,K表示查询时刻数量scanf("%d%d", &n, &m);//数据量大用scanf比较快//每辆车string包含一堆Event,用vector存储,Event包含时间(hh:mm:ss),状态(in or out)unordered_map<string, vector<Event>> cars;char id[10], status[10];for (int i = 0; i < n; i++){int hh, mm, ss;scanf("%s %d:%d:%d %s", id, &hh, &mm, &ss, status);int t = hh * 3600 + mm * 60 + ss;//时间,用秒为单位int s = 0;if (status[0] == 'o') s = 1;//状态是out的话,s=1,否则状态为in,s=0cars[id].push_back({ t, s });//t是时间,s是状态}vector<Event> events;//从unordered_map cars中取出一条条记录,first是string,second是vector<Event>//vector<Event>包含许多Event,每个Event包含时间,状态for (auto& item : cars){//auto是引用类型,外面改了,cars里面也改auto& ets = item.second;//ets就是vector<Event>,ets就是events缩写//注意ets是引用sort(ets.begin(), ets.end());//就是对每辆车的vector<Event>排序,按时间从小到大int k = 0;//k记录合法状态//遍历当前这辆车的记录(时间,状态)for (int i = 0; i < ets.size(); i++) {if (ets[i].status == 0){//当前状态是in(0代表in,1代表out)//又如果i+1的状态是out(因为都已经按照时间从小到大排序过了)if (i + 1 < ets.size() && ets[i + 1].status == 1){//也不弄个新的vector<Event>,直接原地覆盖!ets[k++] = ets[i];ets[k++] = ets[i + 1];//加上for循环后面那个i++,+了两次,指针往前移了两位,因为插入了in,out这一对儿i++;}}}ets.erase(ets.begin() + k, ets.end());//没有配对儿好的记录都删掉for (int i = 0; i < k; i++) {//把清理后的记录(in,out都配对儿),放进一个新的vector<Event> events;events.push_back(ets[i]);}}//重新在排序?//这是把每辆车的in,out(配对后)都放入一个vector<Event> events中//包含了所有车的in,out,然后再统一排序一次//之前的排序,是对每辆车的in,out排序,这次是全放一起进行再排序//此时不会是in,out,in,out按序下来了,可能里面是一排in在最前面sort(events.begin(), events.end());int k = 0;//k用于遍历events里的每条记录(时间,in,out)int sum = 0;//sum记录学校里停放的车辆数//读入m个询问while (m--){//读入的询问统一转为秒int hh, mm, ss;scanf("%d:%d:%d", &hh, &mm, &ss);int t = hh * 3600 + mm * 60 + ss;//如果k在events范围内(遍历),该条记录的时间在t(输入的查询时间)之前while (k < events.size() && events[k].tm <= t){//并且该条记录还是in,那么停车数量++,否则--if (events[k].status == 0) sum++;else sum--;k++;//k++用于遍历events的下一条记录}//输出当前时间,学校里停放的车辆的总数printf("%d\n", sum);}//再做第二问://maxt记录停车的最大时间,遍历cars,求出最大时间//因为之前对cars 的引用做修改,所以cars里面的vector<Event> 都是清理后的,in,out成对儿int maxt = 0;for (auto& item : cars) maxt = max(maxt, get(item.second));//遍历每辆车,看谁的停放总时间等于 maxt,就保存vector<string> res;for (auto& item : cars) {if (get(item.second) == maxt) {res.push_back(item.first);}}//把车辆名词按字典序输出吧,要排序sort(res.begin(), res.end());for (int i = 0; i < res.size(); i++) {//printf("%s ", res[i].c_str());cout << res[i] << ' ';}printf("%02d:%02d:%02d\n", maxt / 3600, maxt % 3600 / 60, maxt % 60);}
};class Solution2 {
public:void func() {}
};int main() {Solution s;s.func();return 0;
}//先要确定如何存储这些数据,输入的数据就n条记录,和m条查询,每条记录包含车辆id,时间,状态(in,out),
//先创建一个结构体Event,存放车辆的时间和状态,再创建哈希表unordered_map<string, vector<Event>> cars;
//车辆id对应一堆Event,输入时间时,通过scanf("%d:%d:%d", &hh, &mm, &ss)技巧直接保存秒数,输入状态时,
//将字符串in,out转换为int保存。
//
//然后遍历每辆车,取出每辆车的vector<Event>,通过双指针,对其数据清理(去掉无效的in或者out)
//
//对in,out数据清理,因为有可能是in in out 这样的顺序,将他们都排成in out成对儿的数据
//因为是引用变量,所以清理后原来的每辆车的Event里面的in out 也清理成 成对儿出现
//将清理后的in out放一起,放在 vector<Event> events 里,有一个in就+1,一个out减一,就可以找出
//某时间之前,停靠的车辆有多少
//最后遍历所有的车(车的Event已经清理,都是in out成对儿的),通过get函数(每个配对儿的out减去in,得到
//本次停留的时间,全部加起来,得到总的停留时间),得到每辆车停留时间,记录在maxt。再遍历每辆车,
//都调用get函数,看谁和maxt一样,就把车辆id放进  vector<string> res里,最后遍历输出res,就是停留
//最久的车辆是哪几部了。maxt就是其最长停留时间

PAT 十一章 模拟 1-16 自用相关推荐

  1. PAT 十一章 模拟 17-24 自用

    十一模拟十7 1595. 螺旋矩阵 PAT甲级真题1105 1595. 螺旋矩阵 给定一个包含 N 个正整数的序列,请你将序列中的元素以非递增顺序填充到螺旋矩阵中. 从左上角的第一个元素开始填充,并按 ...

  2. 【正点原子FPGA连载】第十一章PL SYSMON测量输入模拟电压 摘自【正点原子】DFZU2EG_4EV MPSoC之嵌入式Vitis开发指南

    1)实验平台:正点原子MPSoC开发板 2)平台购买地址:https://detail.tmall.com/item.htm?id=692450874670 3)全套实验源码+手册+视频下载地址: h ...

  3. 鸟哥的Linux私房菜(基础篇)- 第十一章、认识与学习 BASH

    第十一章.认识与学习 BASH 最近升级日期:2009/08/25 在 Linux 的环境下,如果你不懂 bash 是什么,那么其他的东西就不用学了!因为前面几章我们使用终端机下达命令的方式,就是透过 ...

  4. 【正点原子Linux连载】第七十一章 Linux 4G通信实验 -摘自【正点原子】I.MX6U嵌入式Linux驱动开发指南V1.0

    1)实验平台:正点原子阿尔法Linux开发板 2)平台购买地址:https://item.taobao.com/item.htm?id=603672744434 2)全套实验源码+手册+视频下载地址: ...

  5. 鸟哥的Linux私房菜(服务器)- 第十一章、远程联机服务器SSH / XDMCP / VNC / RDP

    第十一章.远程联机服务器SSH / XDMCP / VNC / RDP 最近更新日期:2011/11/24 维护网络服务器最简单的方式不是跑去实体服务器前面登入,而是透过远程联机服务器联机功能来登入主 ...

  6. 第十一章、远程联机服务器SSH / XDMCP / VNC / RDP

    维护网络服务器最简单的方式不是跑去实体服务器前面登入,而是透过远程联机服务器联机功能来登入主机, 然后再来进行其他有的没的维护就是了.Linux 主机几乎都会提供 sshd 这个联机服务,而且这个服务 ...

  7. 频谱仪的更改ip_【正点原子FPGA连载】第五十一章 基于FFT IP核的音频频谱仪-摘自【正点原子】开拓者 FPGA 开发指南 (amobbs.com 阿莫电子论坛)...

    本帖最后由 正点原子 于 2020-10-24 15:19 编辑 203429z6c3os33t8albi33.png (66.36 KB) 2019-7-28 15:14 上传 第五十一章 基于FF ...

  8. 鸟哥的Linux私房菜(基础篇)- 第二十一章、系统配置工具(网络与打印机)与硬件侦测

    第二十一章.系统配置工具(网络与打印机)与硬件侦测 最近升级日期:2009/09/15 除了手动配置之外,其实系统提供了一个名为 setup 的命令给系统管理员使用喔!这个命令还能够配置网络呢.此外, ...

  9. 信息系统项目管理师---第十一章项目风险管理历年考题

    信息系统项目管理师-第十一章项目风险管理历年考题 1.2005 年 5 月第 47 题 :在项目风险管理的基本流程中,不包括下列中的(C ). A.风险分析 B.风险追踪 C.风险规避措施 D.风险管 ...

最新文章

  1. Flash Builder 找不到所需的Adobe Flash Player调试器版本的解决办法
  2. 专家:端午将至湖北地区挂马网站激增 用户需警惕
  3. 转载--How to Install VMware Tools on CentOS 6.3
  4. portal开发下拉框“日期框”查询要怎么配置
  5. 【企业管理】怎么把战略和规划转化为实际行动
  6. 2020-10-11 LMI线性矩阵不等式的一些知识
  7. 古代大臣上朝时手里拿的是什么东西
  8. 悲观锁和乐观锁_浅谈数据库悲观锁和乐观锁
  9. 1.极限——例子_2
  10. 单片机片外程序存储器数据存储器操作命令
  11. java web乱码问题_Java Web中文乱码问题解决
  12. Apache Storm技术实战之3 -- TridentWordCount
  13. Java实现随机验证码和验证码图片渲染功能
  14. 碳排放权交易管理办法即将施行,你知道火电厂的碳排放是怎么算出来的吗?
  15. 关于安卓毛玻璃实现(一)动态毛玻璃
  16. 照片太大怎么压缩200k?图片怎么缩小到200k以下?
  17. 仿网易云PC端项目-vue
  18. Obi Fulid对于URP支持注意事项
  19. Java开发:哪些技能测试来评估Java开发人员的技能?
  20. MATLAB算法实战应用案例精讲-【人工智能】枝晶生长模型(附matlab代码实现)

热门文章

  1. 敷完面膜后要擦水乳吗_敷完面膜还要擦水乳吗
  2. 2019.08.29考试报告
  3. java 图类_java笔记之图形类详解
  4. python怎样输出多个空格_Python实现将多个空格换为一个空格.md的方法
  5. 词霸天下---142词根 【-scape- 形状 】
  6. 阿里妈妈获得商品详情 API 返回值说明
  7. 【Web前端开发】——HTML练习一:标记信件
  8. 高斯模糊原理和python实现
  9. 听话的苹果-第11届蓝桥杯Scratch选拔赛真题精选
  10. 面试官:你很优秀,现在就签合同!95后扭头就走:不把我当人