1 solutions
-
-1
#include<bits/stdc++.h> using namespace std; struct HYRiao{ template<typename any> void out(any a,string end=""){ cout<<a<<end; } template<typename any> void in(any &a){ cin>>a; } }; struct HYRcom{ long double nsum(long double a,long double b){ return a+b; } bool bsum(bool a,bool b,string x="&"){ if(x=="&"){ return a&&b; } else if(x=="!"){ if(a==b){ return 0; } else{ return 1; } } else if(x=="|"){ return a||b; } else if(x=="!&"){ return bsum(!a,b); } else if(x=="&!"){ return bsum(a,!b); } else if(x=="!!"){ return !bsum(a,b,"!"); } else{ return 0; } } string ssum(string a,string b,string x="+"){ if(x=="+"){ return a+b; } if(x=="c+h"){ string c; for(int i=0;i<a.size()||i<b.size();i++){ c+=a[i]+b[i]; } return c; } if(x=="c+t"){ string c; for(int i=a.size()-1,j=b.size()-1;i>=0||j>=0;i--,j--){ if(i>=0&&j>=0)c+=a[i]+b[j]; if(i<0)c+=b[j]; if(j<0)c+=a[j]; } reverse(c.begin(),c.end()); return c; } return "wrong"; } char csum(char a,char b){ return a+b; } long double ndif(long double a,long double b){ return a-b; } char cdif(char a,char b){ return a-b; } string sdif(string a,string b,string x="c-t"){ if(x=="c-h"){ string c; for(int i=0;i<a.size()||i<b.size();i++){ c+=a[i]-b[i]; } return c; } if(x=="c-t"){ string c; for(int i=a.size()-1,j=b.size()-1;i>=0||j>=0;i--,j--){ if(i>=0&&j>=0)c+=a[i]-b[j]; if(i<0)c+=b[j]; if(j<0)c+=a[j]; } reverse(c.begin(),c.end()); return c; } return "wrong"; } long double npro(long double a,long double b){ return a*b; } char cpro(char a,char b){ return a*b; } string spro(string a,string b,string x="c*t"){ if(x=="c*h"){ string c; for(int i=0;i<a.size()||i<b.size();i++){ c+=a[i]*b[i]; } return c; } if(x=="c*t"){ string c; for(int i=a.size()-1,j=b.size()-1;i>=0||j>=0;i--,j--){ if(i>=0&&j>=0)c+=a[i]*b[j]; if(i<0)c+=b[j]; if(j<0)c+=a[j]; } reverse(c.begin(),c.end()); return c; } } long double ncuo(long double a,long double b){ return a/b; } long double intexp(long double a,long long x){ long double a1=a; for(long long i=1;i<x;i++)a*=a1; return a; } }; struct HYRbin{ long long intodec(string s,int x){ long long ret=0; int sum=1; for(int i=s.size()-1;i>-1;i--){ if(s[i]>='0'&&s[i]<='9') ret+=sum*int(s[i]-'0'); if(s[i]>='A'&&s[i]<='Z') ret+=sum*(10+int(s[i]-'A')); sum*=x; } return ret; } string intother(long long n,int x){ string ret; while(n>0){ if(n%x<10)ret+=char((n%x)+'0'); else ret+=char((n%x)-10+'A'); n/=x; } reverse(ret.begin(),ret.end()); return ret; } string ifoto(string s,int from,int to){ return intother(intodec(s,from),to); } }; int main(){ HYRiao HYRiao; HYRcom HYRcom; HYRbin HYRbin; { int n; for(int i=0;i<1;i++)//特殊的for循环用法[微笑] HYRiao.in(n); HYRiao.out(n*(n+1)/2); } }
- 1
Information
- ID
- 54
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- 10
- Tags
- # Submissions
- 5
- Accepted
- 4
- Uploaded By