poj1320

解一元二次方程

简单题

打表

View Code
#include <iostream>
#include
<cstdio>
#include
<cstdlib>
#include
<cstring>
#include
<cmath>
using namespace std;

//int last(long long x)
//{
// long long l = x * (x - 1);
//// y * (2 * x + 1 + y) == l;
//// y * y + (2 * x + 1) * y - l == 0;
// long long b = 2 * x + 1;
// double z = (-b + sqrt(b * b + 4 * l)) / 2;
// int y = (int)z;
// while (y * (b + y) >= l)
// y--;
// while (y * (b + y) < l)
// y++;
// if (y * (b + y) != l)
// return -1;
// return (int)x + y;
//}
//
//int main()
//{
// freopen("t.txt", "r", stdin);
// int cnt = 0;
// for (int i = 6; cnt < 10; i++)
// {
// int temp = last(i);
// if (temp != -1)
// {
// printf("f[%d][0] = %d;\nf[%d][1] = %d;\n", cnt, i, cnt, temp);
// cnt++;
// }
// }
// return 0;
//}

int main()
{
int f[10][2];
f[
0][0] = 6;
f[
0][1] = 8;
f[
1][0] = 35;
f[
1][1] = 49;
f[
2][0] = 204;
f[
2][1] = 288;
f[
3][0] = 1189;
f[
3][1] = 1681;
f[
4][0] = 6930;
f[
4][1] = 9800;
f[
5][0] = 40391;
f[
5][1] = 57121;
f[
6][0] = 235416;
f[
6][1] = 332928;
f[
7][0] = 1372105;
f[
7][1] = 1940449;
f[
8][0] = 7997214;
f[
8][1] = 11309768;
f[
9][0] = 46611179;
f[
9][1] = 65918161;
for (int i = 0; i < 10; i++)
printf(
"%10d%10d\n", f[i][0], f[i][1]);
}
posted @ 2011-08-24 09:51  金海峰  阅读(300)  评论(0编辑  收藏  举报