-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1926C.cpp
82 lines (80 loc) · 1.37 KB
/
1926C.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cerrno>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define intx int64_t
#define mod 1000000007
// bismillah
const intx mx=200'007;
intx arr[mx];
int vivid(intx x)
{
intx sum=0;
while(x!=0)
{
intx r=x%10;
sum=sum+r;
x=x/10;
}
return sum;
}
void weZnaz()
{
int boom;
cin>>boom;
cout<<arr[boom]<<endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
intx test = 1;
arr[1]=1;
for(intx i=2;i<mx;i++)
{
arr[i]=arr[i-1]+vivid(i);
}
cin >> test;
while (test--)
{
weZnaz();
}
return 0;
}