摘要: "PAT 1089 狼人杀 简单版" 思路:利用二重循环for i=1:n 1, for j=i+1:n假设第i,j是狼人,记号temp中的值为 1,其余人为1表示好人。首先判断这两个狼人中有且只有一个撒谎, 如何判断一个人撒谎:vi[k] temp[abs(vi[k])] include incl 阅读全文
posted @ 2019-04-07 22:24 A-Little-Nut 阅读(250) 评论(0) 推荐(0) 编辑
摘要: "1086 就不告诉你 " include include using namespace std; int main(){ int a, b, flag=0; cin a b; string str=to_string(a b); for(int i=str.size() 1; i =0; i ) 阅读全文
posted @ 2019-04-03 21:49 A-Little-Nut 阅读(139) 评论(0) 推荐(0) 编辑
摘要: "1087 有多少不同的值" include include include using namespace std; int main(){ int n; cin n; set s; for(int i=1; i 阅读全文
posted @ 2019-04-03 21:48 A-Little-Nut 阅读(157) 评论(0) 推荐(0) 编辑
摘要: "1088 三人行" 注:丙可是小数 include include include using namespace std; int main(){ int m, x, y, flag=0; double ans[3]; cin m x y; for(int i=99; i 9; i ){ int 阅读全文
posted @ 2019-04-03 21:45 A-Little-Nut 阅读(139) 评论(0) 推荐(0) 编辑
摘要: void memset(void s, int ch, size_t n); 函数解释:将s中当前位置后面的n个字节 (typedef unsigned int size_t )用 ch 替换并返回 s 。 void memcpy(void dest, const void src, size_t 阅读全文
posted @ 2019-02-20 20:03 A-Little-Nut 阅读(137) 评论(0) 推荐(0) 编辑
摘要: "结点选择" cpp / 首先这道题输入的边的两端的结点不是上一行的结点的权值,而是 结点的序号,其次,这道题并没有说这个树是二叉树并且也没有说边左 边的结点就是父亲结点,右边的结点就是孩子结点,所以这道题树的存 储用无向图来存储。 关于算法就是树形规划:从叶子结点往上到根节点进行动态规划, 利用d 阅读全文
posted @ 2019-02-18 10:18 A-Little-Nut 阅读(734) 评论(1) 推荐(2) 编辑
摘要: "K好数" cpp / 不难的动态规划 / include include using namespace std; int main(){ int k, l; int dp[105][105]; cin k l; memset(dp, 0, sizeof(dp)); for(int i=1; i 阅读全文
posted @ 2019-02-13 17:47 A-Little-Nut 阅读(217) 评论(0) 推荐(0) 编辑
摘要: "最大最小公倍数" cpp include using namespace std; / getlcd()求两个数的最大公约数 / long long int getlcd(long long int a, long long int b){ return (a%b==0?b:getlcd(b, a 阅读全文
posted @ 2019-02-13 17:45 A-Little-Nut 阅读(204) 评论(0) 推荐(0) 编辑
摘要: "区间k大数查询" cpp include include include using namespace std; bool cmp(const int& a, const int& b){ return a b; } int main(){ int n; cin n; vector vi(n+1 阅读全文
posted @ 2019-02-13 17:43 A-Little-Nut 阅读(152) 评论(0) 推荐(0) 编辑
摘要: "Eurodiffusion" cpp / 并未完全AC / include include include using namespace std; int c;//国家数目(即货币数目) int cas=0;//测试组数 const int motif=1000000; struct CTR{/ 阅读全文
posted @ 2019-02-13 17:41 A-Little-Nut 阅读(594) 评论(0) 推荐(1) 编辑