intmain() { int a, b, c; cin >> a >> b >> c; if(a > b) swap(a,b); if(b > c) swap(b,c); if(a > b) swap(a,b); cout << a << "->" << b << "->" << c << endl; return0; }
intmain(){ string s; getline(cin, s); for (int i = 0; i < s.size(); i++) { bool flag = false; int cnt = 1; int j = i + 1; if (s[i] == '6') { while (s[j++] == '6') cnt++; if (cnt > 9) { flag = true; cout << "27"; } elseif (cnt > 3) { flag = true; cout << "9"; } } if (flag) { i = j - 2; continue; } cout << s[i]; } return0; }
1-4 考试座位号
分数 15
全屏浏览题目
切换布局
作者 陈越
单位 浙江大学
每个 PAT 考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码。
输入格式:
输入第一行给出一个正整数 N(≤1000),随后 N 行,每行给出一个考生的信息:准考证号 试机座位号 考试座位号。其中准考证号由 16 位数字组成,座位从 1 到 N 编号。输入保证每个人的准考证号都不同,并且任何时候都不会把两个人分配到同一个座位上。
#include<algorithm> #include<cstring> #include<iostream> #include<map> #define x first #define y second usingnamespace std; // 准考证 考试座位号 typedef pair<string, string> PII; // 座位号 map<int, PII> m;
intmain(){ int N; cin >> N; while (N--) { string a, c; int b; cin >> a >> b >> c; m[b] = {a, c}; } int M; cin >> M; while (M--) { int a; cin >> a; cout << m[a].x << " " << m[a].y << endl; } return0; }
把原文中所有独立的 can you、could you 对应地换成 I can、I could—— 这里“独立”是指被空格或标点符号分隔开的单词;
把原文中所有独立的 I 和 me 换成 you;
把原文中所有的问号 ? 换成惊叹号 !;
在一行中输出替换后的句子作为 AI 的回答。
输入格式:
输入首先在第一行给出不超过 10 的正整数 N,随后 N 行,每行给出一句不超过 1000 个字符的、以回车结尾的用户的对话,对话为非空字符串,仅包括字母、数字、空格、可见的半角标点符号。
输出格式:
按题面要求输出,每个 AI 的回答前要加上 AI: 和一个空格。
输入样例:
1 2 3 4 5 6 7
6 Hello ? Good to chat with you can you speak Chinese? Really? Could you show me 5 What Is this prime? I,don 't know
输出样例:
1 2 3 4 5 6 7 8 9 10 11 12
Hello ? AI: hello! Good to chat with you AI: good to chat with you can you speak Chinese? AI: I can speak chinese! Really? AI: really! Could you show me 5 AI: I could show you 5 What Is this prime? I,don 't know AI: what Is this prime! you,don't know