On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L": turn 90 degrees to the left; "R": turn 90 degress to the right. The r
题目如下: On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: "G": go straight 1 unit; "L": turn 90 degrees to the left; "R": turn 90 degress to the right.
// 自己写的还行吧,数组不要忘了开的大一点;#include <iostream>using namespace std;struct str { string id; int sj; int ks;} s[1010];int main(){ int n, m, x; cin >> n; for (int i = 0; i < n; i++){ cin >> s[i].id >> s[i].sj &g
题目链接:考试座位号 题目描述: 每个 PAT 考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们
题目传送门:https://pintia.cn/problem-sets/994805260223102976/problems/994805281567916032 题解: #include<iostream>#include<string>using namespace std;struct Infor{ string str; int num1; int num2;};void InitInfor(Infor infor[],int n){ for(
#include<iostream> #include<vector> using namespace std; #define N 10010 struct node { int v; int p; }; int main() { node A[N] = { 0,0 }; int n; cin >> n; int max = 0; int ans = -1; for (int i = 1; i <= n; i++) {
题目意思就是找到第一个没有重复的数,数据只有10^5,所以用数组水了一下。如果比较大的话应该要用map和vector。 #include <iostream> #include <string.h> #define maxn 100005 int a[maxn],b[maxn]; int main() { int n,x; memset(a,0,sizeof(a)); scanf("%d",&n);