记录编号 |
123585 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2010冲刺四]报数 |
最终得分 |
100 |
用户昵称 |
HouJikan |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.003 s |
提交时间 |
2014-09-27 22:58:20 |
内存使用 |
0.32 MiB |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <set>
#include <list>
#include <iterator>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <functional>
#include <deque>
#define For(i,j,k) for(int i=(j);i<=(k);i++)
using namespace std;
typedef long long LL;
typedef unsigned int Uint;
const int INF=0x7ffffff;
//================struct declaration======================
struct Fishes
{
LL V,X;
bool operator <(const Fishes &rhs) const{
return V<rhs.V;
}
friend inline istream &operator >>(istream &is,Fishes &p){
is>>p.V>>p.X;
return is;
}
};
//================var declaration=-========================
string ans="";
//================function declaration====================
string readnum(string num,int level);
//================main code===============================
using namespace std;
int main()
{
string ProgrammeName="readrule";
string FloderName="COGS";
freopen((ProgrammeName+".in").c_str(),"r",stdin);
freopen((ProgrammeName+".out").c_str(),"w",stdout);
#ifdef DEBUG
//clock_t Start_Time=clock();
//system(("cp C:\\Users\\Administrator\\Desktop\\"+FloderName+"\\standard.cpp C:\\Users\\Administrator\\Desktop\\"+FloderName+"\\submit.txt").c_str());
#endif
ios::sync_with_stdio(false);
string num;
cin>>num;
if (num[0]=='-') cout<<"F";
while (num[0]=='-'||num[0]=='+'||(num.length()!=1&&num[0]=='0'&&num[1]!='.'))
num=num.substr(1,num.length()-1);
if ((num.length()==1&&num[0]=='0')||(num[0]=='0'&&num[1]=='.'))
cout<<"0";
int point=num.find('.');
if (point==string::npos)
point=num.length();
int pos=point-1;
int D=1;
while (pos>=3){
string temp=readnum(num.substr(pos-3,4),D);
ans=temp+ans;
pos-=4;
D++;
}
if (pos!=-1)
ans=readnum(num.substr(0,pos+1),D)+ans;
cout<<ans;
if (point!=num.length()){
cout<<"D";
for(point++;point<num.length();point++)
cout<<num[point];
}
#ifdef DEBUG
//clock_t End_Time=clock();
//printf("\n\nTime Used :%.6lf Ms\n",double(Start_Time-End_Time)/(-CLOCKS_PER_SEC));
#endif
return 0;
}
//================function code===========================
string readnum(string num,int D)
{
string ans;
int len=num.length()-1;
For(p,0,len){
if (num[p]=='0'&&(p=='0'||num[p-1]!='0')&&p!=len)
ans=ans+'0';
else if (num[p]!='0')
{
ans=ans+num[p];
if (len-p==1)
ans+='S';
if (len-p==2)
ans+='B';
if (len-p==3)
ans+='Q';
}
}
if(D==2)
ans+='W';
if (D==3)
ans+='Y';
return ans;
}