xlucn / pat Goto Github PK
View Code? Open in Web Editor NEWPAT OJ exercises in C language 浙江大学PAT纯C语言题解。
Home Page: https://xlucn.github.io/PAT/
PAT OJ exercises in C language 浙江大学PAT纯C语言题解。
Home Page: https://xlucn.github.io/PAT/
1010题有点小问题,提交只是部分正确
pat题解网站打不开了,可以麻烦大佬解决一下嘛?
测试点最后一直出错
看了你的发现应该describe三维数组大小问题
为什么column要申明为5 ( ? _ ? )(题目说最多四个字符。。。)
char symbol[3][10][4]; // wrong
`#include <stdio.h>
#include <string.h>//gets函数
int main()
{
int i, k;
char *p,str[81];
gets(str);
k = strlen(str);
p = str + k-1;
while (p>=str)
{
if (*p == ' ' && *(p+1) != ' ')
{
*p = '\0';
printf("%s ", p+1);
}
if(p==str)
printf("%s",p);
p--;
}
return 0;
}`
可能用指针方式更好理解
https://github.com/OliverLew/PAT/blob/ceda48cc3713d4fb77df707257034e9130af7b6d/PATBasic/1052.c#L53-L57
m[0]<=10重复了5次,我想应该是m[0]……m[4]<=0
#include <bits/stdc++.h>
using namespace std;
map<int,vector<int> >mp;
map<int,bool>shown;
bool isvalid(vector <int> box){
for(int i=0;i<box.size();i++){
for(int j=0;i<mp[box[i]].size();j++)
if(shown[mp[box[i]][j]])return false;
}return true;
}
int main(int argc, char **argv)
{
int n,m;
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++){
int a,b;
scanf("%d %d",&a,&b);
mp[a].push_back(b);
mp[b].push_back(a);
}
for(int i=0;i<m;i++){
int t;
cin>>t;
vector<int > box;
shown.clear();//
while(t--){
int b;
cin>>b;
box.push_back(b);
shown[b]=true;
}
if(isvalid(box))printf("Yes\n");
else printf("No\n");
}
return 0;
}
/* read the rest of the line */
if(c != '\n')
while(getchar() != '\n');
不加这段代码会有两个点通不过,不理解这部分代码的作用?
简书的两个同学发现的,第一个同学指出的时候,我当时还没反应过来-_-#
我的判断唯一性的函数中有这个判断条件:
if(array[i][j] == array[x0][y0] && i != x0 && j != y0)
后面这个防止同一元素的条件是错的。应该改为
if(array[i][j] == array[x0][y0] && !(i == x0 && j == y0))
e.g. in a1020, there is one line of code:
node nodes[CNODE] = {{post, in, N}}, *p = nodes, *n;
The warning message says
Liquid Warning: Liquid syntax error (line 76): Expected end_of_string but found comma in "{{post, in, N}}" in /home/luxu/Code/PAT/_articles/a1020.md
其中题目明确要求不使用别的数组,可以有不使用数组的方法解决吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.