Coder Social home page Coder Social logo

xlucn / pat Goto Github PK

View Code? Open in Web Editor NEW
410.0 410.0 87.0 3.05 MB

PAT OJ exercises in C language 浙江大学PAT纯C语言题解。

Home Page: https://xlucn.github.io/PAT/

C 98.75% Makefile 1.25%
c gh-pages github-page oj online-judge pat pat-exercises programming-ability-test zju

pat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pat's Issues

1003.c部分代码不理解

        /* read the rest of the line */
        if(c != '\n')
            while(getchar() != '\n');

不加这段代码会有两个点通不过,不理解这部分代码的作用?

1052. 卖个萌 (20)

测试点最后一直出错
看了你的发现应该describe三维数组大小问题
为什么column要申明为5 ( ? _ ? )(题目说最多四个字符。。。)

char symbol[3][10][4]; // wrong

1009.c改进意见

`#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;

}`
可能用指针方式更好理解

PAT Basic 1068: 判断逻辑错误

简书的两个同学发现的,第一个同学指出的时候,我当时还没反应过来-_-#

我的判断唯一性的函数中有这个判断条件:

if(array[i][j] == array[x0][y0] && i != x0 && j != y0)

后面这个防止同一元素的条件是错的。应该改为

if(array[i][j] == array[x0][y0] && !(i == x0 && j == y0))

'{{ }}' in code is treated as Liquid tags by jekyll

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

1090PATbasic部分正确

#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;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.