算法入门
小耗子001
得到的和得不到的都是收获
展开
-
patA1012 The Best Rank(有个段错误)
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <cmath>using namespace std;char map[6]={'0','A','C','M','E'};struct student{ char id[20...原创 2018-04-23 20:04:55 · 406 阅读 · 1 评论 -
patB 1033旧键盘打字(超时)
#include <iostream>#include <cstdio> #include <cstring> using namespace std;int HashT[128]={0};int main(int argc, char** argv) {// printf("%d",'+'); char str1[100005],str2[100005]; g...原创 2018-04-25 21:57:24 · 284 阅读 · 0 评论 -
patA 1062. Talent and Virtue
#include <iostream>#include <cstdio> #include <algorithm>#include <cstring>using namespace std;struct person{ char id[15]; int v_score; int g_score; int rank; bool in; person()...原创 2018-04-21 21:55:08 · 182 阅读 · 0 评论 -
patA1048 Find Coins
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int main(int argc, char** argv) { int n,k; scanf("%d %d",&n,&k); int num[max...原创 2018-05-03 15:04:36 · 143 阅读 · 0 评论 -
patB1005 继续3n+1 猜想
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int hashT[100000]={0};void find(int x){ while(x!=1){ if(x%2==0) { x/=2; hashT[x]=1; } else{ x=3*x...原创 2018-05-03 13:52:39 · 167 阅读 · 0 评论 -
patA1048 Find coins 用散列进行优化
#include <iostream>#include <cstdio> using namespace std;const int maxn=10001;int hashT[maxn]={0};int main(int argc, char** argv) { int n,m; scanf("%d %d",&n,&m); for(int i=0;i<...原创 2018-05-03 15:37:59 · 179 阅读 · 0 评论 -
patA1084 Broken Keyboard
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int hashT[128];int main(int argc, char** argv) {// printf("%d %d",'a','A');// printf("%d",'_'); char str1[10...原创 2018-04-24 21:33:50 · 150 阅读 · 0 评论 -
PatA 1083 List Grades
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;struct student{ char name[15],id[15]; int grade; bool operator <(const student & a) const { retur...原创 2018-04-24 20:52:51 · 132 阅读 · 0 评论 -
patA 1075 Pat Judge
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int problem[6]={0};struct student{ char id[20]; int is_submit[6]; int hig...原创 2018-04-24 20:34:29 · 196 阅读 · 0 评论 -
patA1050 String Subtration
#include <iostream>#include <cstdio>#include <cstring>using namespace std;char str1[10001];char str2[10001];int hashT[128]={0}; //record the number;int main(int argc, cha...原创 2018-05-02 15:06:15 · 141 阅读 · 0 评论 -
patB1047编程团体赛
#include <iostream>#include <cstdio> using namespace std;int team_score[1010]={0};int main(int argc, char** argv) { int n; scanf("%d",&n); int team_id,player_id,grade; for(int i=0;i<...原创 2018-05-02 14:28:45 · 143 阅读 · 0 评论 -
patB1042 字符统计
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int hashT[27]={0};int main(int argc, char** argv) { char str[1200]; gets(str); for(int i=0;i<strlen(str);...原创 2018-05-02 00:00:52 · 188 阅读 · 0 评论 -
patA1055 The World's Richest
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;struct richman{ char name[15]; int age; int worth;}man[100005];struct queryman{ in...原创 2018-04-23 21:40:47 · 195 阅读 · 0 评论 -
patA1028 List Sorting
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;struct student{ int id; char name[10]; int score;}stu[100002];bool cmp1(student a,...原创 2018-04-23 20:57:19 · 128 阅读 · 0 评论 -
patA1012 The Best Rank
#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>using namespace std;struct student{ int id; int grade[4];}stu[2010];char course[]={'A','C','M','E'...原创 2018-04-23 20:05:35 · 188 阅读 · 0 评论 -
patB1038 统计同成绩的学生
#include <iostream>#include <cstdio> using namespace std;int HashT[101]={0};int main(int argc, char** argv) { int n; scanf("%d",&n); for(int i=0;i<n;i++){ int score; scanf("%d",&a...原创 2018-04-25 22:05:19 · 145 阅读 · 0 评论