为防止广告,目前nocow只有登录用户能够创建新页面。如要创建页面请先登录/注册(新用户需要等待1个小时才能正常使用该功能)。

Sgu/107

来自NOCOW
< Sgu
跳转到: 导航, 搜索

难得的水题啊~ 搜索1~9位,可知当且仅当n=9时,有八个解,而第十位以及以上的位数,无法决定低位,由此联想~

[编辑] Pascal

Program problem_987654321;
Const
	inp='input.txt';
	oup='output.txt';
Var
	n,i:longint;
Begin
	assign(input,inp); reset(input);
	assign(output,oup); rewrite(output);
	readln(n);
	if n<=8 then writeln(0)
	else if n=9 then writeln(8)
	else begin
		dec(n,10);
		write(72);
		for i:=1 to n do write(0);
		writeln;
	end;
	close(input); close(output);
End.

[编辑] Cpp

#include<iostream>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n<9) cout<<0<<endl;
	else if(n==9) cout<<8<<endl;
	else
	{
		n-=10;
		cout<<"72";
		for(int i=1;i<=n;i++) cout<<"0";//输出很长,建议此处换为putchar
		cout<<endl;
	}
 
	return 0;
}
个人工具