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 |
cin可以过,不会TLE。另,这题的数据貌似有问题。#include <iostream> using namespace std; int main() { unsigned long long int n, b, k, sum, t; while ( cin>>n>>k ) { sum = 0; b = 0; while ( n != 0 ) { sum += n; t = n; n = (t + b) / k; b = (t + b) % k; } cout<<sum<<endl; } return 1; } 以上是我的代码。 在Discuss看到lihaosky的AC代码。 这题输入:4 5 应该输出:4 但是lihaosky的代码输出5也AC了。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator