-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.cpp
More file actions
149 lines (144 loc) · 3.51 KB
/
A.cpp
File metadata and controls
149 lines (144 loc) · 3.51 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#include <bits/stdc++.h>
#include <vector>
using namespace std;
///**************************** M a c r o ****************************///
#define fi(i,n) for(int x = 0 ; x<n;x++) //to write 2d arrays faster ,generally arrays use
#define ll long long
#define Speedo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define f(i,m,n) for(int i=m; i<n; i++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define print(arr,size) for(int i = 0; i<size;i++){cout<<arr[i]<<" ";}cout<<endl;
#define news(f) int f; cin>>f;
#define endl '\n'
#define return0 return 0
#define Endl endl
#define ull unsigned long long
#define ssort(arr,n) sort(arr,arr+n)
#define elif else if
#define lo(f) if (f>='a' && f<='z')
#define up(f) if (f>='A' && f<='Z')
#define pff(a) a.size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define test cout<<" We Fucked up Here Boss_________________"<<endl
#define pii pair<int,int>pair
#define lmao(s,arr) for(int i = 0 ; i <s.size();i++){arr[i]=s[i];}
#define allout(first) for(auto ele : first) {cout<<ele<<" ";}cout<<endl;
#define f(i,n) for(int i = 0 ; i<n;i++)
#define ceil(x) static_cast<long long>(ceil(x))
#define float(x) static_cast<long long>(float(x))
#define round(x) static_cast<long long>(round(x))
#define cnt(s,k) count(all(s),k)
///**************************** F U N C T I O N S ****************************///
//Comment Code Block Ctrl + K + C / Ctrl + K + U-->remove comment
template <class T = int>
T scan() {
T res;
std::cin >> res;
return res;
}
ll fastpower(ll base, ll power, ll m)
{
if (power == 0)return 1;
int res = fastpower(base, power / 2, m) % m;
res *= res;
if (power % 2)
{
return ((res % m) * (base % m)) % m;
}
else {
return res % m;
}
}
int koko = 0;
int knapSack(int W, int wt[], int val[], int n)
{
// Base Case
if (n == 0 || W == 0)
return 0;
// If weight of the nth item is more
// than Knapsack capacity W, then
// this item cannot be included
// in the optimal solution
if (wt[n - 1] > W)
return knapSack(W, wt, val, n - 1);
// Return the maximum of two cases:
// (1) nth item included
// (2) not included
else
return max(
val[n - 1]
+ knapSack(W - wt[n - 1],
wt, val, n - 1),
knapSack(W, wt, val, n - 1));
}
vector<int>ally;
void solve(int indx, vector<int>& v, int weight, int n)
{
//base case
if (indx >= v.size())
{
return;
}
if (weight > n)
{
ally.pop_back();
}
if (weight == n and !ally.empty())
{
for (auto ele : ally)cout << ele << " ";
cout << endl;
ally.clear();
}
//transition
ally.push_back(v[indx]);
solve(indx + 1, v, weight + v[indx], n);
if(!ally.empty())
ally.pop_back();
solve(indx + 1, v, weight, n);
}
#define sttkl(v) static_cast<long long>(v)
int digsum(string s)
{
int sum = 0;
for (auto ele : s)sum += (ele - '0');
return sum;
}
void ace()
{
int n;
cin >> n;
for (int i = n;; i++)
{
string soso = to_string(i);
if (digsum(soso) % 4 == 0)
{
//cout << digsum(soso); return;
cout <<soso<< endl; return;
}
}
}
int main()
{
Speedo;
int t;
t = 1;
//cin >> t;
while (t--)
{
ace();
}
}
// static (data type) by3'aly al data type mostmr
/**/
/* stuff you should look for
* int overflow, array bounds
* special cases (n=1?)
* do smth instead of nothing and stay organized
* WRITE STUFF DOWN
* DON'T GET STUCK ON ONE APPROACH
* DON"T GET STUCK ON ONE PROBLEM
*/
// 1 1 1 1 1 1 1 1
// 1,1 1,2 1,3 1,4 1,5 1,6 1,7 1,8