求北大ACM网站的1001题的答案

来源:百度知道 编辑:UC知道 时间:2024/06/27 15:52:54
我想知道北大ACM网站的1001题的答案
哪位高手告诉我一下?

#include <iostream>
#include <string>
#include <vector>

using namespace std;

class power
{
friend istream&operator>>(istream&In, power&r);
public:
string operator()(int n);
private:
vector<int> s;
int dot;
};

istream&operator>>(istream&In, power&r)
{
string tmp;
In>>tmp;
for(int i=0; i!=6; ++i)if(tmp[i]=='.')r.dot=6-i-1;
r.s.clear();
for(int i=5; i>=0; --i)if(tmp[i]!='.')r.s.push_back(tmp[i]-'0');
return(In);
}

string power::operator()(int n)
{
vector<int>answer(n*5);
answer[0]=1;
for(int i=0; i!=n; ++i)
{
vector<int>tmp(answer);
for(int j=0; j!=n*5; ++j)answer[j]=0;
for(int j=0; j!=n*5; ++j)
for(int k=0; k!=5; ++k)