随笔分类 - implementation
摘要:思路:枚举每张牌,然后加入这张牌,看这牌是否能胡。判胡:1.注意特判 7 对子,九一 这两个胡牌规则 2.(胡的牌里必须有一个对子)枚举这个对子,然后再进行处理就方便多了注意:情况1特判和情况2的牌可能会重复,要去重。View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int vis[6][11], num[6][11];char a[15][5];struct node{ int x, y; node(){} node(int xx, int
阅读全文
摘要:模拟题,每个字母代表一个数字,最多有五个字母,然后搜索一下即可。View Code #include<stdio.h>#include<string.h>#include<map>#include<algorithm>using namespace std;char s1[12], s2[12], s3[12];int a, b, c;int len1, len2, len3;int ans, num;bool vis[12];map<char, int> mm; // 表示映射,int表示 字母char是第几个加入map里面的,从1
阅读全文
摘要:第一次遇到20s的题,果断暴力,贡献多个TLE, 水题也不是完全水的,必须要适当的优化一下,学习了。View Code #include<stdio.h>#include<string.h>#include<algorithm>using namespace std;#define lld __int64lld gcd(lld a, lld b) //最大公约数 { return a ? gcd(b%a, a) : b; }int n, k;int a[802];bool vis[802];int main(){ int i, j; while( ~scan
阅读全文

浙公网安备 33010602011771号