| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
跪求各位大牛,那些20K左右memory的C/C++是怎么做的?好多题都见到占好少内存的程序,不知道他们怎么做到的?
#include <iostream>
using namespace std;
void main()
{
unsigned n,a,i;
while (cin>>n)
{
for (i=1,a=1;a%n;i++)
{
a=(a%n*10)+1;
}
cout<<i<<endl;
}
}
我这程序只定义3个变量,实在想不明白再怎么少了
菜鸟,各位毋见笑!
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator