test

Posted on 2021-01-19 22:34  jinxes6  阅读(94)  评论(0)    收藏  举报

Just follow what Dinomax(orz) did.


As everyone knows, the higher the concentration is, the stronger the man will be.


  1 #include<iostream>
  2 #include<cstdio>
  3 #include<cstdlib>
  4 #include<cstring>
  5 #include<cmath>
  6 #include<algorithm>
  7 #include<stack>
  8 #include<queue>
  9 #include<vector>
 10 #include<string>
 11 #include<set>
 12 #include<map>
 13 using namespace std;
 14 
 15 //faster_reader
 16 inline int read ()
 17 {
 18     int f = 1, a = 0;
 19     char c = getchar ();
 20     while (c < '0' || c > '9')
 21     {
 22         if (c == '-') f = -1;
 23         c = getchar ();
 24     }
 25     while (c >= '0' && c <= '9')
 26     {
 27         a = a * 10 + c - '0';
 28         c = getchar ();
 29     }
 30     return f * a;
 31 }
 32 
 33 //high_accuracy
 34 const int maxn = 100;
 35 struct bign{
 36     int d[maxn], len;
 37 
 38     void clean() { while(len > 1 && !d[len-1]) len--; }
 39 
 40     bign()          { memset(d, 0, sizeof(d)); len = 1; }
 41     bign(int num)   { *this = num; }
 42     bign(char* num) { *this = num; }
 43     bign operator = (const char* num){
 44         memset(d, 0, sizeof(d)); len = strlen(num);
 45         for(int i = 0; i < len; i++) d[i] = num[len-1-i] - '0';
 46         clean();
 47         return *this;
 48     }
 49     bign operator = (int num){
 50         char s[20]; sprintf(s, "%d", num);
 51         *this = s;
 52         return *this;
 53     }
 54 
 55     bign operator + (const bign& b){
 56         bign c = *this; int i;
 57         for (i = 0; i < b.len; i++){
 58             c.d[i] += b.d[i];
 59             if (c.d[i] > 9) c.d[i]%=10, c.d[i+1]++;
 60         }
 61         while (c.d[i] > 9) c.d[i++]%=10, c.d[i]++;
 62         c.len = max(len, b.len);
 63         if (c.d[i] && c.len <= i) c.len = i+1;
 64         return c;
 65     }
 66     bign operator - (const bign& b){
 67         bign c = *this; int i;
 68         for (i = 0; i < b.len; i++){
 69             c.d[i] -= b.d[i];
 70             if (c.d[i] < 0) c.d[i]+=10, c.d[i+1]--;
 71         }
 72         while (c.d[i] < 0) c.d[i++]+=10, c.d[i]--;
 73         c.clean();
 74         return c;
 75     }
 76     bign operator * (const bign& b)const{
 77         int i, j; bign c; c.len = len + b.len;
 78         for(j = 0; j < b.len; j++) for(i = 0; i < len; i++)
 79             c.d[i+j] += d[i] * b.d[j];
 80         for(i = 0; i < c.len-1; i++)
 81             c.d[i+1] += c.d[i]/10, c.d[i] %= 10;
 82         c.clean();
 83         return c;
 84     }
 85     bign operator / (const bign& b){
 86         int i, j;
 87         bign c = *this, a = 0;
 88         for (i = len - 1; i >= 0; i--)
 89         {
 90             a = a*10 + d[i];
 91             for (j = 0; j < 10; j++) if (a < b*(j+1)) break;
 92             c.d[i] = j;
 93             a = a - b*j;
 94         }
 95         c.clean();
 96         return c;
 97     }
 98     bign operator % (const bign& b){
 99         int i, j;
100         bign a = 0;
101         for (i = len - 1; i >= 0; i--)
102         {
103             a = a*10 + d[i];
104             for (j = 0; j < 10; j++) if (a < b*(j+1)) break;
105             a = a - b*j;
106         }
107         return a;
108     }
109     bign operator += (const bign& b){
110         *this = *this + b;
111         return *this;
112     }
113 
114     bool operator <(const bign& b) const{
115         if(len != b.len) return len < b.len;
116         for(int i = len-1; i >= 0; i--)
117             if(d[i] != b.d[i]) return d[i] < b.d[i];
118         return false;
119     }
120     bool operator >(const bign& b) const{return b < *this;}
121     bool operator<=(const bign& b) const{return !(b < *this);}
122     bool operator>=(const bign& b) const{return !(*this < b);}
123     bool operator!=(const bign& b) const{return b < *this || *this < b;}
124     bool operator==(const bign& b) const{return !(b < *this) && !(b > *this);}
125 
126     string str() const{
127         char s[maxn]={};
128         for(int i = 0; i < len; i++) s[len-1-i] = d[i]+'0';
129         return s;
130     }
131 };
132 istream& operator >> (istream& in, bign& x)
133 {
134     string s;
135     in >> s;
136     x = s.c_str();
137     return in;
138 }
139 ostream& operator << (ostream& out, const bign& x)
140 {
141     out << x.str();
142     return out;
143 }
144 
145 //graph
146 const int N = 1010, M = 100010;
147 int head[N], num = 0;
148 struct edge
149 {
150     int nxt, to, val;
151 };
152 edge e[M];
153 void add_edge(int x, int y, int z)
154 {
155     e[++ num].nxt = head[x];
156     head[x] = num;
157     e[num].to = y;
158     e[num].val = z;
159 }
160 
161 //quick_pow
162 const int mod = 1e9 + 7;
163 long long qpow(long long x, int y)
164 {
165     long long ans = 1;
166     while (y)
167     {
168         if (y & 1)
169         {
170             ans *= x;
171             ans %= mod;
172         }
173         x *= x;
174         x %= mod;
175         y >>= 1;
176     }
177     return ans;
178 }
179 
180 //gcd
181 inline int gcd(int a, int b)
182 {
183     int r;
184     while(b > 0)
185     {
186         r = a % b;
187         a = b;
188         b = r;
189     }
190     return a;
191 }
192 
193 int main()
194 {
195     int T = 1;
196     //T = read();
197     while (T --)
198     {
199 
200     }
201     return 0;
202 }
init

OK

It's time for codeforces