记录编号 |
402591 |
评测结果 |
AAAAAA |
题目名称 |
加法问题 |
最终得分 |
100 |
用户昵称 |
YGOI_真神名曰驴蛋蛋 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.000 s |
提交时间 |
2017-05-06 21:44:33 |
内存使用 |
0.00 MiB |
显示代码纯文本
#include<cstdio>
void *x=freopen("aplusb.out","w",stdout);
void *y=freopen("aplusb.in","r",stdin);
double a,b;
int k=scanf("%lf %lf",&a,&b);
int p=printf("%.0lf",a+b);
int main(){;}
/*
#include <cstdio>
#include <iostream>
#include <queue>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <string>
#include <ctime>
#include <cstdlib>
#include <windows.h>
#include <algorithm>
//#define Sleep(x) ((void)(0))
//using namespace std;
HANDLE COLOR_CHANGE = GetStdHandle(STD_OUTPUT_HANDLE) ;
const int FBEFORE = FOREGROUND_INTENSITY ;
const int FBLUE = FOREGROUND_BLUE |FBEFORE ;
const int FGREEN = FOREGROUND_GREEN|FBEFORE ;
const int FRED = FOREGROUND_RED|FBEFORE ;
const int FBLACK = 0 ;
const int FWHITE = FBLUE|FGREEN|FRED|FBEFORE ;
const int BBEFORE = BACKGROUND_INTENSITY ;
const int BBLUE = BACKGROUND_BLUE|BBEFORE ;
const int BGREEN = BACKGROUND_GREEN|BBEFORE ;
const int BRED = BACKGROUND_RED|BBEFORE ;
const int BBLACK = 0 ;
const int BWHITE = BBLUE|BRED|BGREEN|BBEFORE ;
inline void SetPos(const int&,const int&);
inline void SetPos(const COORD&);
inline void SetColor(const int&,const int&);
inline void CPrint(const char*,const int&,const int&);
inline void SetPos(const int&i=0,const int&j=0)
{
COORD pos= {i, j};
SetPos(pos);
}
inline void SetPos(const COORD&a)
{
HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out,a);
}
inline void SetColor(const int&FRONT=FWHITE,const int&BACK=BBLACK)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FRONT|BACK);
}
inline void CSPrint(const char*s,const int&FRONT=FWHITE,const int&BACK=BBLACK,const int&SPEED=50)
{
SetColor(FRONT,BACK);
while(*s) {
putchar(*(s++));
Sleep(SPEED);
}
SetColor();
}
namespace LONGER
{
typedef long long ll;
typedef unsigned long long UTYPE;
typedef ll TYPE;
const TYPE sll=sizeof(TYPE);
const TYPE MAXLENGTH=80;
inline TYPE max(const TYPE&a,const TYPE&b)
{
return a<b?b:a;
}
inline void Swap(long long &a,long long &b)
{
a=a^b;
b=a^b;
a=a^b;
}
struct Longer {
#define LOWBIT 1000000000
int size;
TYPE num[MAXLENGTH];
Longer(const TYPE&a=0) {
size=1;
memset(num,0,sizeof(num));
num[1]=a;
}
TYPE &operator[](int x) {
return num[x];
}
};//num[1]涓烘渶浣庝綅
Longer operator +(const Longer&,const Longer&);
Longer operator -(const Longer&,const Longer&);
Longer operator *(const Longer&,const Longer&);
Longer operator /(const Longer&,const Longer&);
Longer operator /(const Longer&,const TYPE&);
Longer operator % (const Longer&,const Longer&);
Longer operator <<(const Longer&,const TYPE&);
Longer operator >>(const Longer&,const TYPE&);
bool operator <(const Longer&,const Longer&);
bool operator >(const Longer&,const Longer&);
bool operator >=(const Longer&,const Longer&);
bool operator <=(const Longer&,const Longer&);
bool operator !=(const Longer&,const Longer&);
bool operator ==(const Longer&,const Longer&);
void read(Longer &);
void put(const Longer&);
Longer exchange(const Longer&);
Longer exchange(const Longer&a)
{
Longer c;
c.size=a.size;
for(int i=1; i<=a.size; ++i)
c.num[i]=a.num[a.size-i+1];
return c;
}
Longer operator <<(const Longer&a,const TYPE&b)
{
Longer c;
c.size=a.size+b;
for(int i=1; i<=a.size; ++i)
if( i+b <MAXLENGTH )c.num[i+b]=a.num[i];
return c;
}
Longer operator >>(const Longer&a,const TYPE&b)
{
Longer c;
c.size=max(1,a.size-b);
for(int i=b+1; i<=a.size; ++i)
c.num[i-b]=a.num[i];
return c;
}
Longer operator +(const Longer &a,const Longer &b)
{
Longer c;
c.size=max(a.size,b.size);
for(int i=1; i<=c.size; ++i)
c.num[i]=a.num[i]+b.num[i];
for(int i=1; i<=c.size; ++i) {
c.num[i+1]+=c.num[i]/LOWBIT;
c.num[i]%=LOWBIT;
}
while(c.num[c.size+1]!=0)c.size++;
return c;
}
Longer operator -(const Longer &a,const Longer &b)
{
if(a<b)return 0;
Longer c;
c.size=max(a.size,b.size);
for(int i=1; i<=c.size; ++i)
c.num[i]=a.num[i]-b.num[i];
for(int i=1; i<=c.size; ++i)
if(c.num[i]<0) {
c.num[i]+=LOWBIT;
--c.num[i+1];
}
while(c.num[c.size]==0&&c.size>0)--c.size;
return c;
}
Longer operator *(const Longer &a,const Longer &b)
{
Longer c;
c.size=a.size+b.size-1;
for(int i=1; i<=a.size; ++i)
for(int j=1; j<=b.size; ++j)
c.num[i+j-1]+=a.num[i]*b.num[j];
for(int i=1; i<=c.size; ++i) {
c.num[i+1]+=c.num[i]/LOWBIT;
c.num[i]%=LOWBIT;
}
if(c.num[c.size+1]!=0)c.size++;
return c;
}
Longer operator / (const Longer&a,const TYPE&b)
{
if(b==1)return a;
TYPE d=0;
Longer c;
c.size=a.size;
for(int i=c.size; i>=1; --i) {
c.num[i]=(d*LOWBIT+a.num[i])/b;
d=(d*LOWBIT+a.num[i])%b;
}
while(c.num[c.size]==0&&c.size>0)--c.size;
return c;
}
Longer operator / (const Longer &_a,const Longer &_b)
{
if(_b==1)return _a;
Longer l=1,r=1,mid,p,a=_a,b=_b;
if(b==0) {
printf("Runtime Error in Big Integer :: the devided number cannot be zero.\n");
abort();
}
if(a==0||a<b)return 0;
TYPE k=max(a.size-b.size,0);
l=l<<(k-1);
r=r<<(k+1);
//put(l);put(r);
while(l<r) {
mid=((l+r)/2);
p=mid*b;
if(p==a)return mid;
else if(p>a)r=mid+(-1);
else l=mid+1;
}
if(l*b>a)return l-1;
return l;
}
Longer operator %(const Longer &_a,const Longer&_b)
{
return _a-(_a/_b)*_b;
}
bool operator <(const Longer&a,const Longer&b)
{
if(a.size!=b.size)return a.size<b.size;
for(int i=a.size; i>=1; --i)
if(a.num[i]!=b.num[i])
return a.num[i]<b.num[i];
return 0;
}
bool operator >(const Longer&a,const Longer&b)
{
return b<a;
}
bool operator >=(const Longer&a,const Longer&b)
{
return a>b||a==b;
}
bool operator <=(const Longer&a,const Longer&b)
{
return a<b||a==b;
}
bool operator !=(const Longer&a,const Longer&b)
{
return !(a==b);
}
bool operator ==(const Longer &a,const Longer&b)
{
return !(a<b)&&!(b<a);
}
void read(Longer &t)
{
t=0;
std::string s;
char str[1024];
scanf("%s",str);
s=str;
int sizen=s.length();
// printf("\n\nsizen->%d\n\n",sizen);
int p=sizen%9,i=0;
TYPE k=0;
t.size=sizen/9+(sizen%9!=0);
if(p!=0) {
for(i=0; i<p; ++i)k=k*10+s[i]-'0';
t.num[t.size--]=k;
k=0;
}
while(t.size) {
p=i+9;
for(; i<p; ++i)k=k*10+s[i]-'0';
t.num[t.size--]=k;
k=0;
}
t.size=sizen/9+(sizen%9!=0);
t=t+0;
}
void put(const Longer &k)
{
printf("%lld",k.num[k.size]);
for(int i=k.size-1; i>=1; --i)
printf("%.9lld",k.num[i]);
}
}
LONGER::Longer NAME;
struct PLAYER {
std::string name;
bool is_ing;
int lp,atk,def,sp;
int clsc;
int milk;
int have_fly;
int iced,fired;
int iced_cnt,fired_cnt;
PLAYER() {
lp=10000;
atk=1000;
def=1000;
sp=100;
clsc=0;
milk=0;
is_ing=false;
}
void hash() {
NAME=1;
name+=' ';
while(NAME.size<20) {
int lens=name.length();
for(int i=1; i<lens; ++i)
NAME=NAME*abs(name[i])+abs(name[i-1]);
}
name.erase(name.end()-1);
lp+=NAME[1]%30000;
atk+=NAME[2]%2000;
def+=NAME[3]%2000;
sp=NAME[4]%94;
clsc=rand()%3+2;
is_ing=0;
milk=0;
have_fly=0;
fired=0;fired_cnt=0;
iced=0;iced_cnt=0;
if(name=="RiseFalcon") {
lp=25000;
atk=2500;
def=2000;
sp=70;
}
if(name=="SkyMiner") {
lp=25000;
atk=2800;
def=2000;
sp=75;
}
if(name=="liu_runda") {
lp=25000;
atk=2400;
def=2300;
sp=75;
}
if(name=="Sa") {
lp=25000;
atk= 0;
def=8000;
sp=2;
}
if(name=="DaDaDaDaDa") {
lp=25000;
atk=0;
def=0;
sp=94;
}
if(name=="AntiLeaf") {
lp=30000;
atk=2800;
def=2000;
sp=60;
}if(name=="L_in") {
lp=10000;
atk=8000;
def=8000;
sp=40;
}if(name=="Zhlj") {
lp=23000;
atk=2800;
def=2600;
sp=50;
}if(name=="_Itachi") {
lp=26000;
atk=2600;
def=2000;
sp=30;
}if(name=="Kito") {
lp=30000;
atk=1800+600*clsc;
def=1500+600*clsc;
sp=std::min(60+clsc*2,93);
}if(name=="SHS") {
lp=28000;
atk=2300;
def=3000;
sp=40;
}if(name=="XZ") {
lp=35000;
atk=3000;
def=2000;
sp=40;
}if(name=="GLS") {
lp=25000;
atk=1500+clsc*600;
def=2500+clsc*200;
sp=66;
}
if(name=="ItalyLily") {
lp=30000;
atk=2000;
def=2000;
sp=20;
}
if(name=="MagicSheep") {
lp=26000;
atk=3000;
def=2000;
sp=20;
}
if(name=="Keller") {
lp=25000;
atk=2500;
def=2000;
sp=60;
}
//printf("DEBUG");
}
};
std::vector<PLAYER>p;
void print(PLAYER&a){
std::cout<<a.name<<": 生命 "<<a.lp<<" 攻击"<<a.atk<<" 防御"<<a.def<<" 闪避"<<a.sp<<" 超量素材"<<a.clsc<<std::endl;
}
bool is_die(PLAYER&a,PLAYER&b)
{
using namespace std;
if(b.lp<=0) {
system("color 4F");
system("color F0");
system("color 4F");
system("color F0");
system("color 4F");
system("color F0");
system("color 4F");
system("color F0");
system("color 4F");
system("color F0");
Sleep(500);
system("color 0F");
SetColor(FRED);
int tmp=rand()%3;
cout<<' '<<b.name<<' '<<"生命值归零,"<<' '<<a.name<<' '<<"获得了"<<tmp<<"个超量素材!"<<endl;
SetColor();a.clsc+=tmp;
return true;
} else return false;
}
int answer(PLAYER&a,PLAYER&b,int fec)
{
if(fec==1) {
if(rand()%std::max((100-b.sp),0)<=5)return 0;
else if(a.name=="_Itachi"&&a.is_ing)return rand()%4000;
else return std::max(a.atk-b.def,0)+rand()%500;
}
if(fec==2) {
if(rand()%(100-b.sp)==0)return 0;
else return rand()%1500;
}
}
void action(PLAYER &a,PLAYER &b)
{
using namespace std;
int k=rand()%500,p;
if(a.name=="Kito") {
a.atk=1800+600*a.clsc;
a.def=1500+600*a.clsc;
a.sp=std::min(60+2*a.clsc,93);
}
if(a.name=="GLS") {
a.atk=1500+400*a.clsc;
a.def=2500+200*a.clsc;
a.sp=66;
}
if(a.name=="ItalyLily"){
int tmp=rand()%2;
if(tmp==0){CSPrint(" ItalyLily 开始卖萌 交换了",FRED,BBLACK,20);
CSPrint("攻击和防御!\n",FRED,BBLACK,20);
swap(a.atk,a.def);
}
}
if(a.clsc>0){
if(a.name=="RiseFalcon"&&a.clsc>=2&&(5000-b.def>b.lp||5000-b.def>=3000||b.def==7000||(k>=375&&k<=400)) ) {
CSPrint(" RiseFalcon 取除了2个超量素材,发动了绝技 旋风的腐女俯冲轰炸断木机!\n",FBLUE,BBLACK,20);
a.clsc-=2;
const int cc=5;
int x0=b.atk/cc,x1=b.def/cc,x2=b.lp/cc;
a.atk+=x0;a .def+=x1; a.lp+=x2;
b.atk-=x0; b.def-=x1; b.lp-=x2;
return;
}
if(a.name=="SkyMiner"&&a.clsc>=1&&(a.lp<=12000||(k>=375&&k<=400)) ) {
CSPrint(" SkyMiner 取除了1个超量素材,发动了绝技 超电磁炮,造成4000伤害!\n",FGREEN,BBLACK,20);
a.clsc-=1;
b.lp-=4000;
cout<<' '<<b.name<<' '<<"还剩"<<b.lp<<"点生命"<<endl;
return;
}
if(a.name=="liu_runda"&&a.clsc>=2&&(18000>a.lp||(k>=275&&k<=400)) ) {
CSPrint(" liu_runda 取除了2个超量素材,发动了绝技 昊昊大袋马,恢复了8000生命!\n",FRED|FBLUE,BBLACK,20);
a.clsc-=2;
a.lp+=8000;
cout<<' '<<a.name<<' '<<"还剩"<<a.lp<<"点生命"<<endl;
return;
}
if(a.name=="Sa"&&a.clsc>=2&&(18000>a.lp||(k>=375&&k<=400)) ) {
CSPrint(" Sa 取除了2个超量素材,发动了绝技 人群中的光头,攻击力与防御力交换!\n",FBLUE|FGREEN,BBLACK,20);
a.clsc-=2;
swap(a.atk,a.def);
return;
}
if(a.name=="AntiLeaf"&&a.clsc>=2&&(18000>a.lp||(k>=375&&k<=400)) ) {
CSPrint(" AntiLeaf 取除了2个超量素材并掏出了他的毒奶!\n",FBLUE|FGREEN,BBLACK,20);
a.clsc-=2;a.milk++;
return;
}
if(a.name=="L_in"&&a.clsc>=1&&(10000>a.lp||(k>=375&&k<=400))){
CSPrint(" L_in 去除了1个超量素材 以防御力和攻击力为代价 回复10000生命\n",FBLUE,BBLACK,20);
a.clsc-=1;a.atk-=a.atk/2;a.def-=a.def/2;a.lp+=10000;
return ;
}
if(a.name=="Zhlj"&&a.clsc>=3&&k>=200) {
CSPrint(" Zhlj 去除了3个超量素材 对对方造成12000伤害 !效果拔群\n",FRED,BBLACK,20);
a.clsc-=3;b.lp-=12000;
return;
}
if(a.name=="_Itachi"&&a.clsc>=2&&k>=200) {
CSPrint(" _Itachi 去除了2个超量素材 开始掷起了骰子!\n",FRED,BBLACK,20);
a.clsc-=2;a.is_ing=true;
return;
}
if(a.name=="Kito"&&b.clsc>=2&&k>=100) {
CSPrint(" Kito 吸收了对方的1个超量素材!\n",FRED,BBLACK,20);
b.clsc-=1;a.clsc+=1;
a.atk=1800+600*a.clsc;
a.def=1500+600*a.clsc;
a.sp=std::max(60+2*a.clsc,94);
return;
}
if(a.name=="SHS"&&a.clsc>=2&&255<=k&&k<=400) {
CSPrint(" SHS 去除了2个超量素材 把对方归零!\n",FRED,BBLACK,20);
a.clsc-=2;
int x=b.lp;
b.hash();
b.lp=x;
return;
}
if(a.name=="XZ"&&a.clsc>=2&&255<=k&&k<=400) {
CSPrint(" XZ 去除了1个超量素材 !护甲炸裂!\n",FRED,BBLACK,20);
a.clsc-=1;
a.lp-=a.def;
b.lp-=b.def;
return;
}if(a.name=="GLS"&&355<=k&&k<=400) {
CSPrint(" GLS 叠放了自身!上升了1个超量素材,更劲了!\n",FBLUE|FRED,BBLACK,20);
a.clsc+=1;
a.atk=1500+400*a.clsc;
a.def=2500+200*a.clsc;
a.lp+=1;
return;
}if(a.name=="MagicSheep"&&a.lp<=2000&&a.have_fly==0) {
CSPrint(" MagicSheep 大爷生命值不足,被自己弹飞了!化作黄焖鸡浴火重生!\n",FRED,BBLUE,20);
a.have_fly=1;
a.atk=1800;
a.def=2000;
int p=rand()%21;
int x=abs((a.lp-10))*p;
SetColor(FRED,BBLACK);
printf("大爷的生命值由%d点变为10点并造成了变化数值*%d倍的伤害! 恢复了一半生命...\n",a.lp,p);
a.lp=10+x*0.5;b.lp-=x;
SetColor(FWHITE,BBLACK);
return;
}if(a.name=="Keller"&&a.clsc>=8) {
system("color 1F");Sleep(30);
system("color F0");Sleep(30);
system("color 2F");Sleep(30);
system("color F0");Sleep(30);
system("color 3F");Sleep(30);
system("color F0");Sleep(30);
system("color 4F");Sleep(30);
system("color F0");Sleep(30);
system("color 5F");Sleep(30);
system("color F0");Sleep(30);
CSPrint("Keller 取除了8个超量素材,变成了蛤乎玄学家,发出了救世之光!击杀对方!\n",FBLUE,BRED,20);
a.clsc-=8;
b.lp=-1;
return ;
}
}
if(a.name=="AntiLeaf"&&a.milk){
char c[50];
sprintf(c," AntiLeaf 吸了%d口他的毒奶,攻击力上升%d,生命力下降%d!\n",a.milk,200*a.milk,300*a.milk);
CSPrint(c,FBLUE|FGREEN,BBLACK,20);
a.lp-=300*a.milk;a.atk+=200*a.milk;
if(is_die(b,a))return;
}
if(k<=400) {
cout<<' '<<a.name<<' '<<"向"<<' '<<b.name<<' '<<"发起了攻击!";
if(p=answer(a,b,1)) {
cout<<"造成了"<<p<<"的伤害!";
b.lp-=p;
cout<<' '<<b.name<<' '<<"还剩"<<b.lp<<"点生命"<<endl;
if(a.name=="ItalyLily"){
int tmp=p*((double)rand()/RAND_MAX);
cout<<' '<<a.name<<"吸取了"<<tmp<<"点生命!"<<endl;
a.lp+=tmp;
}
} else {
cout<<"只可惜被"<<' '<<b.name<<' '<<"闪开了!"<<endl;;
}
} else if(k>=400&&k<=475) {
cout<<' '<<a.name<<' '<<"居然对"<<' '<<b.name<<' '<<"投毒!造成了"<<(p=rand()%2000)<<"的伤害!";
b.lp-=p;
if(a.name=="ItalyLily"){
int tmp=p/3;
cout<<' '<<a.name<<"的防御增加了"<<tmp<<"点!"<<endl;
a.def+=tmp;
int x=std::min(rand()%5+1,2333333);
cout<<' '<<b.name<<" 从 "<<a.name<<" 手里获得了"<<x<<"个超量素材!"<<endl;
a.clsc-=x;
b.clsc+=x;
}
if(p=answer(a,b,2)) {
cout<<"然而"<<' '<<b.name<<' '<<"恢复能力拔群!恢复了"<<p<<"点体力!";
b.lp+=p;
}
cout<<' '<<b.name<<' '<<"还剩"<<b.lp<<"点生命"<<endl;
}
//cout<<' '<<b.name<<' '<<"还剩"<<b.lp<<"点生命"<<endl;
}
#define Time_Using
#define Continue_Time 500
int main()
{
srand(time(NULL));
using namespace std;
int N;
cout<<"请输入玩家的数量:"<<endl;{
char Np[1024];
while(cin>>Np){
if(sscanf(Np,"%d",&N)!=1||N<2)cout<<"请好好输入"<<endl;
else break;
}
}
p.resize(N+1);
cout<<"请输入玩家的名字(以空格分割):\n";
for(int i=1;i<=N;++i){
cin>>p[i].name;
p[i].hash();
}
Sleep(1000);
for(int i=1;i<=N;++i){
print(p[i]);
}
int cnt=0;
while(p.size()>2) {
cout<<"第"<<(++cnt)<<"回合"<<endl;
random_shuffle(p.begin()+1,p.end());
if(cnt%6==0){
SetColor(FRED|FGREEN);
printf("还剩%d人\n",p.size());
for(int i=1;i<p.size();++i){
if(cnt%12==0)p[i].clsc+=rand()%2;
print(p[i]);
}SetColor();
printf("\n");//getchar();
}
for(int i=1;i<p.size();++i){
int asp=rand()%(p.size()-1)+1;
while(asp==i)asp=rand()%(p.size()-1)+1;
action(p[i],p[asp]);
if(is_die(p[i],p[asp]))
p.erase(p.begin()+asp);
#ifdef Time_Using
Sleep(Continue_Time);
#endif
cout<<endl;
}
}SetColor(FRED);
cout<<endl<<" END"<<endl;
SetColor(FRED|FGREEN);
for(int i=1;i<p.size();++i){
print(p[i]);
}SetColor();
printf("\n");
while(1);
return 0;
}
*/