小白进阶
Acw_power
一步一步
展开
-
PAT 1042 shuffling machine 翻译 分析 代码
题目:1042 shuffling machine (20)(20 分)【洗牌程序】A given order is a permutation of distinct integers in [1, 54]. If the number at the i-th position is j, it means to move the card from position i to position...原创 2018-06-30 10:23:30 · 401 阅读 · 0 评论 -
codeup hashtable_a
#include<cstdio>const int max =210;int hashtable[max]={0};int main(){ int n,m,a[max],i; scanf("%d %d",&n,&m); for(i=1;i<=n;i++){ scanf("%d",&a[i]); if(a[i]>=1&...原创 2018-07-22 00:09:06 · 213 阅读 · 2 评论 -
PAT 1006 sign in and sign out 翻译 分析 代码
#include<cstdio>struct acw{ char id[16] ; int hh,mm,ss;}first,last,temp;bool cmp (acw a,acw b){ if(a.hh!=b.hh ) return a.hh >b.hh ; if(a.mm!=b.mm ) return a.mm >b.mm ; else retu...原创 2018-07-23 00:00:07 · 234 阅读 · 0 评论 -
PAT 1036 Boys and girls 翻译 分析 代码
#include<cstdio>struct acw{ char id[15]; char name[15]; int sorce;}F,M,temp;void init(){ F.sorce=-1,M.sorce=101;}int main(){ int N,i; char sex; init(); scanf("%d",&N); for...原创 2018-07-23 00:55:28 · 377 阅读 · 0 评论 -
PAT 1062 Talent and Virtue 翻译 分析 代码
#include<cstdio>#include<algorithm>#include<cstring>using namespace std;struct student{ char id[10]; int vir,tal,level; int sum; }stu[100010];//这里一定要注意,按照题干的要求,否则出现段错误。很难找...原创 2018-07-30 22:10:44 · 159 阅读 · 0 评论 -
PAT 1077 Kuchiguse 翻译 分析 代码
#include<stdio.h>#include<string.h>int main(){ int i,j,n; scanf("%d",&n); getchar();//吸收换行符; char a[100][256];//构建100列(共有N句话),256行(每句话里面有多少字符) int minlen=256 ; for(i=0;i<n...原创 2018-07-30 23:11:15 · 294 阅读 · 0 评论 -
PAT 1028 List Sorting 翻译 分析 代码
#include<cstdio>#include<algorithm>#include<cstring>using namespace std;struct student{ int id; char name[10]; int sorce;}stu[100010];bool cmp1(student a,student b){ ret...原创 2018-07-31 23:08:06 · 139 阅读 · 0 评论 -
PAT 1039 Course List for Student 翻译 分析 代码
第一次用vector写程序,的确比数组好用多了,慢慢熟悉,相信可以习惯。#include<cstdio>#include<cstring>#include<vector>#include<algorithm>using namespace std;const int N = 40010;const int M = 26 * 26 ...原创 2018-08-09 23:47:39 · 229 阅读 · 0 评论 -
PAT1022 Digital Library
#define _CRT_SECURE_NO_WARNINGS#include<iostream>#include<set>#include<cstdio>#include<map>#include<string>using namespace std;map<string, set<int>>mp原创 2018-08-14 11:51:42 · 189 阅读 · 0 评论 -
PAT 1047 Student List for Course
#define _CRT_SECURE_NO_WARNINGS //这一段是为了VS 2013 对scanf不报错做的声明;#include<algorithm>#include<cstdio>#include<vector>#include<cstring>using namespace std; char name[40010]...原创 2018-08-12 07:59:31 · 95 阅读 · 0 评论 -
PAT 1063 Set Similarity
本节a1063 的知识点有如下:set容器的构造和元素的插入 set<int> acw[51]; acw[i].insert(e); set容器的内容比较for (set<int>::iterator it = acw[a].begin(); it != acw[a].end(); it++) { if (acw[b].f...原创 2018-08-12 10:36:55 · 100 阅读 · 0 评论 -
PAT 1032 Sharing 翻译 分析 代码
实在抱歉这两天更新比较晚,而且缺更,因为复习考研要调整作息和日程规划,这对原本是学渣的我难度较大,花了几天的时间调整,慢慢进入了状态。九月八号就要pat考试了,代码书才看了一半,很慢,不过还是尽量相信自己,考试地点是在西交,上机环境我查了一下,之后VC6.0,VS2008,2013这三种,所以花时间把原来的devc++换成了vs2013,慢慢熟悉和适应这个过程。还有最重要的一点,唱晚,我爱...原创 2018-08-08 00:02:38 · 193 阅读 · 0 评论 -
PAT 1060 Are They Equal
本题运用的string中的.length(),.begin(),.erase()等方法; 本题思想是把数字串存为字符,对字符进行预处理和处理,依据字符形式进行相应的处理,例如0.0123、00123.456等数字。Sample Input 1:3 12300 12358.9Sample Output 1:YES 0.123*10^5Sample Input 2:3 ...原创 2018-08-13 21:55:43 · 268 阅读 · 0 评论 -
PAT 1069 The Black Hole of Numbers 翻译 分析 代码
#include<cstdio>#include<cmath>#include<algorithm>using namespace std;bool xcmp(int a,int b){ return a>b;}void to_array(int a,int b[]){ //数字转化数组 for(int i=3;i>=0;i-...原创 2018-07-30 01:12:44 · 137 阅读 · 0 评论 -
PAT 1093 Count PAT's 翻译 分析 代码
#include<stdio.h>#include<string.h>int main(){ char a[100010]; int i,len,lp[100010]={0},rt=0; gets(a); len = strlen(a); if(a[0]=='P') { lp[0]=1; } for(i=1;i<len;i++) { l...原创 2018-07-29 23:27:07 · 165 阅读 · 0 评论 -
PAT 1046 Shortest Distance 翻译 分析 代码
题目:1046 Shortest Distance (20)(20 分)【最短路径】The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.【案例...原创 2018-07-01 13:50:26 · 663 阅读 · 0 评论 -
PAT 1065 a+b>c 64bit 翻译 分析 代码
题目:1065 a+b>c 64bit (20)(20 分)【加值溢出】Given three integers A, B and C in [-2^63^, 2^63^], you are supposed to tell whether A+B > C.【给出三个整数A,B,C,三者均有限制,[-2^63^, 2^63],判断A+B是否大于C】Input Specification...原创 2018-07-02 17:33:58 · 233 阅读 · 0 评论 -
PAT 1001 a+b 翻译 分析 代码
题目:1001 A+B Format (20)(20 分)【具有格式的a+b】Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four di...原创 2018-06-28 01:26:16 · 254 阅读 · 0 评论 -
PAT 1002 a+b for polynomials 翻译 分析 代码
题目:1002 a+b for polynomials (25)(25 分)【多项式的a+b形式】This time, you are supposed to find A+B where A and B are two polynomials.【计算两个多项式A+B的和】InputEach input file contains one test case. Each case occupies...原创 2018-07-03 11:12:15 · 359 阅读 · 0 评论 -
PAT 1009 a*b for polynomials 翻译 分析 代码
题目: 1009 Product of Polynomials (25)(25 分)【多项式的a*b形式】This time, you are supposed to find A*B where A and B are two polynomials.【这次,你需要去计算两个多项式A*B的产生式】Input Specification:Each input file contains one t...原创 2018-07-04 19:32:15 · 255 阅读 · 0 评论 -
PAT 1031 Hello World for U 翻译 分析 代码
#include<stdio.h>#include<string.h>int main(){ int i,j,n1,n2,n3; char b[40][40]; char a[100]; gets(a); int len=strlen(a); n1=(len+2)/3; n3=n1;n2=len+2-2*n1; //初始化数组 for (...原创 2018-07-25 00:23:05 · 152 阅读 · 0 评论 -
PAT 1011 world cup betting 翻译 分析 代码
#include<cstdio>int main(){ int i,j,wtf[5]; char tit[3]={'W','T','L'}; double ans=1.0,b,temp; for(i=0;i<3;i++) { temp=-1; for(j=1;j<4;j++){ scanf("%lf",&b); if(b>te...原创 2018-07-19 14:39:36 · 174 阅读 · 0 评论 -
PAT 1023 Have Fun with Numbers 翻译 分析 代码
#include<stdio.h>#include<string.h>int hash1[10]={0};int hash2[10]={0};int jud(char a[],int len){ if(a[0]>='5'&&a[0]<='9') { return 0; //false代表不合格的进位大整数; } if(...原创 2018-07-28 15:09:57 · 370 阅读 · 0 评论 -
PAT 1005 Spell It Right 翻译 分析 代码
我宣布,c++天下第一,真的是好简单,寥寥数语就把程序描绘的淋漓尽致。Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each i...原创 2018-07-26 00:33:22 · 151 阅读 · 0 评论 -
linux kali 自学日记
初步入门 linux kali之arp嗅探攻击者 kali ip:192.168.5.128受迫者 win7 ip:192.168.5.129使用工具ettercap 利用ettercap的中间人攻击,达到嗅探目的。linux kali中操作命令 ettercap -Gsniff eth0选项,打开host list 搜索host ,添加网关...原创 2018-07-20 17:28:04 · 920 阅读 · 0 评论 -
linux 自学日记—— DNS劫持
攻击者 kali ip:192.168.5.128受迫者 win7 ip:192.168.5.129首先配置ettercapleafpad /etc/ettercap/etter.dns* A 192.168.5.128*.com A 192.168.5.128*.cn A 192.168.5.128*.or...原创 2018-07-20 20:11:16 · 2481 阅读 · 0 评论 -
PAT 1035 password 翻译 分析 代码
#include<string.h>#include<stdio.h>struct p{ char id[15],password[15]; bool judge;}team[1005];void jud(p &a,int &count){ for(int i=0;i<strlen(a.password);i++){ if(a.p...原创 2018-07-26 12:15:55 · 145 阅读 · 0 评论 -
PAT 1025 Pat betting 翻译 分析 代码
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct student{ char id[15] ; //考生学号 int sorce; //考生分数 int local_number; //考场号 int local...原创 2018-07-21 00:42:33 · 127 阅读 · 0 评论 -
linux bash shell中,单引号、 双引号,反引号(``)的区别及各种括号的区别
一、单引号和双引号首先,单引号和双引号,都是为了解决中间有空格的问题。因为空格在linux中时作为一个很典型的分隔符,比如string1=this is astring,这样执行就会报错。为了避免这个问题,因此就产生了单引号和双引号。他们的区别在于,单引号将剥夺其中的所有字符的特殊含义,而双引号中的'$'(参数替换)和'`'(命令替换)是例外。所以,两者基本上没有什么区别,除非在内容中遇到...转载 2019-08-27 10:12:13 · 235 阅读 · 0 评论