UVa 138: Street Numbers

简单数论题,注意使用long long类型,最好直接打表,因为只要输出十行。

我的解题代码如下:

//#include <iostream>
#include <cstdio>
/*
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <string>
#include <algorithm>

using namespace std;
*/
int main()
{
	printf(
"         6         8\n"
"        35        49\n"
"       204       288\n"
"      1189      1681\n"
"      6930      9800\n"
"     40391     57121\n"
"    235416    332928\n"
"   1372105   1940449\n"
"   7997214  11309768\n"
"  46611179  65918161\n");
	return 0;
}
/*
int main()
{
	long long m=1,c=0;
	double N;
	while(c!=10)
	{
		m++;
		N=(sqrt(1.0+8*m*m)-1)/2;
		if(N==floor(N))
		{
			printf("%10d",m);
			printf("%10.0lf\n",N);
			c++;
		}
	}
	return 0;
}
*/

被注释掉的恢复后是基本的AC代码,但打表可以节省1秒多的时间。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值