- 博客(83)
- 收藏
- 关注
原创 [PAT][Basic level]1087
KeyWords: std::set ; ordered;no-repeat;AC CODE:#include <iostream>using namespace std;#define MAXN 30000+1int main(){ //freopen("sample_input.txt","r",stdin); int flag[MAXN]={0}; int N; cin>>N; int cnt = 0; for(
2021-06-21 21:24:13
103
原创 [PAT][Basic Level Practice]Problem1089
Solution:已知 N 名玩家中有 2 人扮演狼人角色,有 2人说的不是实话,有狼人撒谎但并不是所有狼人都在撒谎。要求你找出扮演狼人角色的是哪几号玩家?——》说谎话的人(liar):一个是狼人(wolf);一个是好人(man)如果有解,在一行中按递增顺序输出 2 个狼人的编号,其间以空格分隔,行首尾不得有多余空格。如果解不唯一,则输出最小序列解 ——即对于两个序列 A=a[1],…,a[M] 和 B=b[1],…,b[M],若存在 0≤k<M 使得 a[i]=b[i](i≤k)
2021-06-20 23:28:44
225
原创 [PAT][Basic Level]1090
KEYWORDS: std :: map <int ,vector > mymap ;(图,构造int型 和 int型一维数组的映射,一 对 多)mymap[item1].push_back(item2);std::vector V; std::vector::iterator ;vector.begin();vector.end();for(iterator = vector.begin() ; iterator != vector; iterator ++)AC CODE:
2021-06-20 22:21:10
120
原创 [PAT][Basic level]1091
KeyWords:to_string();string.substr();format outputAC CODE:#include <iostream>#include <cstring>#include <string>using namespace std;int main(){ //freopen("sample_input.txt","r",stdin); int M; cin>>M; while(
2021-06-20 14:10:06
70
原创 [PAT][Basic level]1095
Keywords:string ;string.substr(pos_start,lenth);std::stoi(string,NULL,10);sort();Not AC CODE:(3/5)#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>using namespace std;struct student{ char num[14];
2021-06-19 18:45:49
72
原创 [PAT][Basic level]1094
Keywords:string ;str.size();str.substr(pos_begin,lenth);sstream;istringstream is; is>>num;NOT AC CODE:(3/5)#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <string>#include <sst
2021-06-19 16:21:43
60
原创 [PAT][Basic Level]1057
KeyWords:count_zero_binary :num | (num+1)count_one_binary :num & (num -1)num >>1;AC CODE:#include <iostream>#include <cstdio>#include <cstdlib>#define M 100000+1#include <cstring>using namespace std;int main(){
2021-06-17 21:03:44
52
原创 [PAT][Basic Level]1054
KeyWords:sscanf(str_input,"%lf",&temp);sprintf(str_cmp,"%.2f",temp);Not AC code:(4/5)#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int main(){ int N; int count = 0;
2021-06-17 16:51:54
59
原创 [PAT][Basic Level]1052
Keywords: vector<vector >sign_map ;two dimensional vector; vector str_input; string.size();string.length();string.substr(pos_start,pos_end); sign_map.push_back();AC CODE:#include <iostream>#include <vector>using namespace std;int
2021-06-17 14:58:55
48
原创 [PAT][Basic Level]1051
Keywords:double ,float,AC CODE:#include <iostream>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;int main(){ double r1,p1,r2,p2; cin>>r1>>p1>>r2>>p2; double a1,b1,a2,b2;
2021-06-16 22:56:09
47
原创 [PAT][Basic Level]1050
Keywords:Dynamic allocation and release of two dimensional array;sort() belongs to NOT AC CODE:(3/5). segmentation fault#include <iostream>#include <cstdio>#include <cstdlib>#include <iomanip>#include <cmath>#include &l
2021-06-16 22:01:09
48
原创 [PAT][Basic Level]1049
Time Limited CODE:#include <iostream>#include <cstdio>#include <cstdlib>#include <iomanip>using namespace std;int main(){ int n; cin>>n; double sum = 0; double temp = 0; double *num_input ; num_input = (double *
2021-06-16 19:24:01
47
原创 [PAT][Basic Level]1048
NOT AC CODE:```cpp#include #include #include #include using namespace std;#define M 100+1int main(){char strA[M];char strB[M];char str_output[M+10];cin>>strA>>strB;char to_char[13]={‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’,‘J’,‘Q’,
2021-06-08 21:17:36
68
原创 [PAT][Basic Level]1035
KeyWords:Insertion_sort(*array,length);Merge_sort(*array,length);AC CODE:#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>#include <iostream>using namespace std;void Inser
2021-06-07 22:26:22
44
原创 [PAT][Basic level]1034
KeyWords:GCD(greatest common divisor);#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;int gcd(int a,int b){ return a%b?gcd(b,a%b):b;}int main(){ int m , n; cin>>m>>n; cout
2021-06-07 17:51:05
81
原创 [PAT][basic Level]1031
AC CODE:#include <cstdio>#include <iostream>#include <cstdlib>#include <cstring>using namespace std;int main(){ int n; cin>>n; char num[18]; int temp = 0; int sum = 0; int quan[17]={7,9,10,5
2021-06-06 16:55:55
43
原创 [PAT][Basic Level]1030
Warning: sometime time limitedAC CODE:#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;int main(){ long long n,p; cin >> n>>p; lon
2021-06-06 16:23:27
44
原创 [PAT][Basic Level]1029
AC CODE:no problem(5/5)#include <cstdio>#include <iostream>#include <cstdlib>#include <cstring>using namespace std;int main(){ char str1[81],str2[82]; cin>>str1>>str2; int flag[128]; memset(f
2021-06-06 15:30:39
43
原创 [PAT][Basic Level] 1026
AC CODE:WARNING:omititng decimal fractions smaller than 0.5 and counting all others(四舍五入)#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>using namespace std;#define CLK_TCK 100int main(){ int c
2021-06-06 10:43:57
82
原创 [PAT][Basic Level]1024
NOT AC CODE :(6/7)One Problem:#include <cstdio>#include <iostream>#include <cstdlib>#include <cstring>using namespace std;int main(){ char num_input[10000]; cin>>num_input; int index = 0 ; bool fla
2021-06-05 17:50:59
51
原创 [PAT][Basic Level]1023
NOT AC CODE(3/5):#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;int main(){ int num[10]; memset(num,0,sizeof(int)*10); int len = 0;
2021-06-05 16:51:13
52
原创 [PAT][Basic Level] 1022 code review
NOT AC CODE:(5/6)One problem#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>#include <iomanip>using namespace std;void PrintBase(int number , int base){ int stor
2021-06-05 16:30:46
52
原创 [PAT][Basic Level]1020 code review
AC CODE:#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <iomanip>#include <cmath>#include <cstring>using namespace std;struct mooncake{ double store; double total
2021-06-05 14:50:27
53
原创 [PAT][Basic Level]1019 done
AC CODE:#include <iostream>#include <algorithm>#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>using namespace std;int ArrayToNumber(char *ch);char * NumberToArray(int number);bool cmp(cha
2021-06-05 13:55:24
54
原创 [PAT][Basic level]1018code review
NOT AC CODE:2 problems to be resolved(4/6)#include <cstdio>#include <cstring>#include <cstdlib>#include <iostream>using namespace std;void print(int count_c,int count_j,int count_b ){ if( count_c > count_j){
2021-06-05 12:58:32
53
原创 [PAT][Basic level] 1017 code review
NOT AC CODE:(2/5)#include <cstdio>#include <cstring>#include <cstdlib>#include <iostream>using namespace std;int main(){ char num[1001]; int b; char q[1001]; int r; cin>>num>>b; int su
2021-06-05 11:38:11
55
原创 [PAT][Basic level] 1016
aside note: the array of strings ends of ‘\0’;#include <cstdio>#include <cstring>#include <cstdlib>#include <iostream>using namespace std;int main(){ char a[10],b[10]; char d_a,d_b; cin>>a>>d_a>>
2021-06-05 10:45:22
40
原创 [PAT][Basic level] 1015 code review
Not AC Code:(one problem to be resolved)KeyWrods: sort();bool cmp();#include “algorithm”;the diffirence between qsort() and sort();struct;typedef (关键字替换);#include <cstdio>#include <iostream>#include <cstring>#include <iomanip>
2021-06-05 10:16:38
82
原创 [PAT][basic level]1014 福尔摩斯的约会
#include <cstdio>#include <iostream>#include <cstring>#include <iomanip>#include <cmath>using namespace std;int main(){ char str1[61],str2[61],str3[61],str4[61]; char week[7][4]={"MON","TUE","WED","THU","FRI","S
2021-06-04 18:03:58
38
原创 about<iomanip>
IO manipulators:Header providing parametric manipulators:C plus plus Reference:《iomanip》setiosflags :Set format flagsresetiosflags :Reset format flagssetbase :Set basefiled flagsetfill :Set fill charactersetprecision :Set decimal precisionset
2021-06-04 15:18:41
111
原创 [PAT][basic level] 1008 review
Keywords: array reverse;defination && declare of the function;pointerAC Code:#include <cstdio>#include <iostream>#include <cstdlib>#include <algorithm>using namespace std;void reverse(int *array , int Pos_start , int
2021-06-04 11:42:13
53
原创 [PAT][Basic level]1005 继续3*n+1猜想
issue to be resolved:segmantation faultCode:#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;bool cmp (int a,int b){ return a > b ;}int main(){.
2021-06-04 10:06:19
69
原创 [PAT][Basic level]Problem 1004:成绩排名 review
KeyWords:struct,malloc,sizeof,struct *,pointer#include <cstdio>#include <iostream>#include <cstdlib>using namespace std;struct student{ char name[11]; char number[11]; int score;};int main (){ int n,i=0; std::
2021-06-03 17:43:54
67
原创 [PAT][basic level] Problem 1003 : 我要通过!review
Pure Code:AC代码#include <iostream>#include <cstring>#include <cmath>using namespace std;int main() { int n; cin>>n; char string[100]; while(n--) { cin>>string; //std::cout << string <<" "<
2021-06-03 16:58:24
45
原创 about “<bits/stdc++.h>“
Main Problem:PAT(basical level) 1028Related Link:https://blog.csdn.net/qq_34451909/article/details/104752861What is it?(“bits/stdc++.h”)StackOverFlow LInk:https://stackoverflow.com/questions/25311011/how-does-include-bits-stdc-h-work-in-c/25311052#
2021-06-03 11:22:50
109
原创 【2021.6.3】Learning Process Record
Main Problem:PAT (Basical Level)1025KeyWords:Linked List;CurrentNode;InitList;DeleteList;InsertList;GetListLength;ReverseList;LocateElement;DestroyList;Related Link:https://blog.csdn.net/u012531536/article/details/80170893
2021-06-03 10:08:39
63
原创 2021-06-02 Apache ECharts
GItHub:https://github.com/apache/echarts;https://github.com/oviliaKeyWords:Information visualization;Web-based visualization(数据可视化;基于web的可视化)Introduction:Apache Echarts is a free, powerful charting and visualization libraryoffering an easy way of
2021-06-02 17:36:57
163
1
原创 【PTA basic level】Problem 1009 review
Keywords:arry;two dimensional arry of stings(字符串二维数组);address;the name of the arry means the first addressaside note: two dimensional arry of stings is separated by branches,whereas(but) its storage structure is continuous.#include<stdio.h>int
2021-05-28 20:58:37
56
原创 【PAT】1007 review
int i;for(i=0; ;) 与 for(int i=0 ; ;) 两种定义循环变量的方式的区别:the difference between int i;for(i = 0;;) and for(int i = 0;;):两种均可,前者i在for循环外部定义,则i的值在程序未结束之前就一直存在,i所占的内存空间直到程序结束时才释放;后者的i在for循环内部定义,则当for循环结束时,i所占的内存空间就被释放了。一般建议用后者的方式,因为当程序较大时,前者更占内存,这样程序在运行时CPU的负担
2021-05-28 16:16:13
51
原创 【2021-05-27】 Learning progress record
PAT(Basic level)-1005关联题: PAT(Basic level)-1001Key Words:卡拉兹(Callatz)猜想 ,C++ 的 STL (Standard Template Library)中 sort函数,sort函数的三个参数(RandomAccessIterator first,RandomAccessIterator last,Compare comp),sort函数的内部实现原理,quick sort,insertion sort,时间复杂度分别是多少以及为什么是
2021-05-27 23:34:19
103
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人