随笔分类 - 3.2.查找元素
摘要:技巧 !!!开一个一维数组,一行一行的接收输入,最后存放的相当于二维数组的每一列的和。 1 #include"stdio.h" 2 #include"string.h" 3 int main() { 4 int a[1001] = {0},N,M,s,i,j,max = -1; 5 scanf("%
阅读全文
摘要:水题,hash题。 #include<iostream> #include<cmath> using namespace std; int hashtable[10000] = {0}; bool isPrime(int n) { //判断是否是素数 if(n <= 1) return false;
阅读全文
摘要:水题。发现PAT考察hash很多。 #include<iostream> #include<unordered_map> using namespace std; struct Student { string id;//学号 int sitNum;//考试座位号 }; int main() { i
阅读全文
摘要:水题。 #include<iostream> using namespace std; int a[100010]= {0}; int main() { int n,num,score,max = -1,pos = -1; cin>>n; for(int i = 0; i < n; ++i) { c
阅读全文
摘要:水题。注意点,可能出现合理生日的总数为0的情况,要特判输出。 #include<iostream> using namespace std; int main() { int n,cnt = 0; string name,birthday; string youngest_name,youngest
阅读全文
摘要:水题。忘了结构体类型变量之间可以直接赋值。惭愧。 #include"iostream" #include"algorithm" using namespace std; struct Student { string name,id; int score; }; int main() { int n
阅读全文
摘要:水题。 #include"iostream" using namespace std; string s[11] = {"ling","yi","er","san","si","wu","liu","qi","ba","jiu"}; int main() { int ans = 0; string
阅读全文

浙公网安备 33010602011771号