摘要:
这道题可以应用数位dp的思想: 既然根据限制条件算出符合条件的数很难,如同大海捞针,那我就直接拿可能用到的数字,按数位把它拼出来,反而还更快。 对于这道题,三个数字就是1到9全排列的三段,我们只要对每个排列,枚举分段方式即可。 #include <stdio.h> #include <algorit 阅读全文
摘要:
简单题,输入有技巧 注意要在正式读入之前先用一个getline把那个回车读入了,因为cin不会处理回车。 #include <iostream> #include <algorithm> #include <stdlib.h> #include <cstring> #include <sstream 阅读全文
摘要:
用一个队列模拟,每次都只处理队头位置的差异 #include <iostream> #include <algorithm> #include <stdlib.h> #include <cstring> using namespace std; const int N = 1005; char s[ 阅读全文