算法学习
草薙京丶
这个作者很懒,什么都没留下…
展开
-
PAT甲级(1011-1015)
1011 https://pintia.cn/problem-sets/994805342720868352/problems/994805504927186944原创 2020-03-30 16:31:24 · 98 阅读 · 0 评论 -
PAT甲级 (1006-1010)
1006 https://pintia.cn/problem-sets/994805342720868352/problems/994805516654460928 #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #include <q...原创 2020-03-30 16:03:38 · 101 阅读 · 0 评论 -
机试指南第十二章 动态规划
P224 12.1 #include <iostream> using namespace std; int main(){ int candle; cin>>candle; int dp[30]; //memset(dp,0,sizeof(dp)); dp[1] = 1; dp[0] = 0; dp[2] = ...原创 2020-03-11 19:25:19 · 99 阅读 · 1 评论 -
机试指南第十一章 图论
P193 习题11.1原创 2020-03-08 22:47:30 · 96 阅读 · 0 评论 -
机试指南第十章 数据结构二
P164 习题10.1 #include <iostream> #include <cstdio> #include <string> using namespace std; string str; struct TreeNode{ int data; TreeNode* leftchild; TreeNode* rightch...原创 2020-03-07 23:19:01 · 93 阅读 · 0 评论 -
机试指南第九章 搜索
P145 习题9.1 #include <iostream> #include <queue> #include <vector> #include <string> #include <map> using namespace std; bool strhas2012(string str){ if (str.find("...原创 2020-03-07 16:13:20 · 85 阅读 · 0 评论 -
机试指南第八章 递归与分治
P135习题 8.1 #include <iostream> using namespace std; int factorial(int n){ if (n == 1){return n;} else {return n*factorial(n-1);} } int zuheshu(int m,int n){ return factorial(m)/(...原创 2020-03-06 21:39:00 · 109 阅读 · 0 评论 -
机试指南第七章 贪心策略
P124习题7.1 超时 #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; struct severmode{ string ip; int index; bool flag;...原创 2020-03-06 15:43:09 · 129 阅读 · 0 评论 -
机试指南第六章 数学问题
P89 习题6.1 #include <iostream> #include <stack> using namespace std; int main(){ freopen("D://case.txt","r",stdin); int numcase; cin>>numcase; stack <int> sta...原创 2020-03-01 21:29:57 · 241 阅读 · 0 评论 -
机试指南第五章 数据结构一
P79 习题5.1原创 2020-02-29 20:52:17 · 89 阅读 · 0 评论 -
机试指南第四章 字符串
P53 习题4.1 #include <iostream> #include <string> #include <cmath> using namespace std; int main(){ string stringcase; while(cin>>stringcase){ int countemp = 0...原创 2020-02-28 22:38:03 · 93 阅读 · 0 评论 -
机试指南第三章 排序
P35 习题 3.1 #include <iostream> #include <algorithm> using namespace std; const int Max = 1000; int arr[Max]; int main(){ // freopen("D:\\case.txt", "r", stdin); int casenum; ...原创 2020-02-24 22:59:34 · 82 阅读 · 0 评论 -
机试指南第二章 暴力求解
P10 习题2.1 #include <iostream> #include <iomanip> //http://t.cn/ using namespace std; bool judge(int x){ while (x!=0){ if (x%10 == 7 ){return true;} x = x/10; } ...原创 2020-02-21 23:30:09 · 186 阅读 · 0 评论 -
PAT甲级(1001-1005)
1001原创 2020-02-16 21:05:03 · 154 阅读 · 0 评论 -
PAT乙级(五)(1011-1015)
1011 #include <iostream> #include <vector> using namespace std; int main() { int sum; cin>>sum; vector <bool> result; long long a,b,c; bool flag; while(sum--){ c...原创 2020-02-15 15:47:44 · 110 阅读 · 0 评论 -
PAT乙级(四)(1008-1010)
1008 下面这段代码显示部分错误。 #include <stdio.h> #include <map> #include <iostream> #include <stack> #include <queue> #include <math.h> #include <vector> using namespac...原创 2020-02-13 21:19:08 · 94 阅读 · 0 评论 -
PAT乙级(三)(1006-1007)
1006 让我们用字母 B 来表示“百”、字母 S 表示“十”,用 12…n 来表示不为零的个位数字 n(<10),换个格式来输出任一个不超过 3 位的正整数。例如 234 应该被输出为 BBSSS1234,因为它有 2 个“百”、3 个“十”、以及个位的 4。 输入格式: 每个测试输入包含 1 个测试用例,给出正整数 n(<1000)。 输出格式: 每个测试用例的输出占一行,用规定的...原创 2020-02-09 21:24:09 · 73 阅读 · 0 评论 -
PAT乙级(二)(1003-1005)
1003 “答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串; 如果 ...原创 2020-02-03 22:20:40 · 193 阅读 · 0 评论 -
PAT乙级(一)(1001-1002)
1001 卡拉兹(Callatz)猜想: 对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把 (3n+1) 砍掉一半。这样一直反复砍下去,最后一定在某一步得到 n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证 (3n+1),以至于有人说这是一个阴谋,卡拉兹是在蓄意...原创 2020-02-03 01:01:44 · 95 阅读 · 0 评论