# PAT1027_1031_1041

##### PAT 1027
#include<iostream>

int r, g, b;

void output(int i){
int ii = i / 13;
int jj = i % 13;
switch (ii){
case 10: printf("A"); break;
case 11: printf("B"); break;
case 12: printf("C"); break;
default:
printf("%d", ii);
}
switch (jj){
case 10: printf("A"); break;
case 11: printf("B"); break;
case 12: printf("C"); break;
default:
printf("%d", jj);
}
}

int main(){

scanf("%d%d%d", &r, &g, &b);
printf("#");
output(r);
output(g);
output(b);

return 0;
}


##### PAT 1031
• 题意的理解：最后一行到底应该有多少个数。
#include<iostream>

using namespace std;

string s;

int main(){

cin >> s;

int len = s.size();

int n1 = (len + 2) / 3 - 1  ;
int n2 = len - 2*n1;

int i;
for (i = 0; i < n1; i++){
cout << s[i];
int tmp = n2 - 2;
while (tmp--) cout << " ";
cout << s[len-1-i] << endl;
}
for (int k = 0; k < n2; k++)
cout << s[i++];

return 0;
}


##### PAT 1041
#include<iostream>
#include<vector>

using namespace std;
int N;
int n;
const int maxn = 100010;
vector<int> v;
int isunique[maxn] = {0};

int main(){

cin >> N;

for (int i = 0; i < N; i++){
cin >> n;
v.push_back(n);
isunique[v[i]] += 1;
}
int flag = 1;
for (int i = 0; i < v.size(); i++){
if (isunique[v[i]] == 1){
cout << v[i] << endl;
flag = 0;
break;
}
}
if (flag) cout << "None" << endl;

return 0;
}

09-18 47

09-18 2851
10-16 1185
07-07 478
02-24 278
09-24 376
12-26
©️2020 CSDN 皮肤主题: 1024 设计师:上身试试