poj 3844 Divisible Subsequences 剩余类,组合计数
摘要:题目地址:http://poj.org/problem?id=3844思路: a[i]+a[i+1]+...+a[j]=s[j]-s[i]; 于是整除等价于 s[i]===s[j] (mod d); 然后统计出现了多少次 c[n][2]就可以了 。 值得注意的是,有可能50000* (50000-1)/2 要用long long每次进入一个新case 后把p 清零,sum【i】表示前i个数的和, 0=#include#includeusing namespace std;int sum[50005];int p[1000000];int main(){int T;cin>>T;in
阅读全文
posted @ 2013-09-04 11:10
浙公网安备 33010602011771号