zrq495
www.zrq495.com
摘要: 令q(x)=bmX^m+bm-1X^(m-1)+...b1X+b0,展开 q(x) * (x-k) = X^(m+1)+[-Kbm+b(m-1)]X^m+...(K+b0)x+K。相同次数的项的系数相等,所以推出 b(m-1)=k*bm+a[n-1], r=k*b0+a[0]。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int main() 7 { 8 int n, p[10010], q[10010], i, k; 9 while (cin >> k) 阅读全文
posted @ 2012-07-27 17:25 zrq495 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 求n*m的网格中有多少九宫格,公式:(n/3)*(m/3)。代码: 1 #include<iostream> 2 3 using namespace std; 4 5 int main() 6 { 7 int n, m; 8 int t; 9 cin >> t;10 while(t--)11 {12 cin >> n >> m;13 cout << (n/3)*(m/3) << endl;14 }15 return 0;16 } 阅读全文
posted @ 2012-07-27 15:34 zrq495 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionOld contest software uses bubble sort for generating final standings. But now, there are too many teams and that software works too slow. You are asked to write a program, which generates exactly the same final standings as old software, but fast.InputThe first line of input conta 阅读全文
posted @ 2012-07-27 14:49 zrq495 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 大数加法 + 打表。代码: 1 #include<iostream> 2 #include<cstring> 3 #include<cstdlib> 4 #include<cstdio> 5 6 using namespace std; 7 8 struct node 9 {10 char s[1000];11 };12 13 int main()14 {15 struct node f[1001];16 int i, j, l, n, m;17 int a[1000], b[1000], r[1000];18 int alen, blen, l 阅读全文
posted @ 2012-07-27 14:33 zrq495 阅读(212) 评论(0) 推荐(0) 编辑