Submission #49284301
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
#include <cstdio>
#include <istream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <queue>
#include <iomanip>
#include <numeric>
#include <string>
#include <fstream>
#include <iterator>
#include <functional>
#include <stack>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define forn(i,n) for (int i = 0; i < int(n); ++i)
#define fore(i, l, r) for(int i = (int)l; i < (int)r; ++i
#define forit(it,a) for(auto it = a.begin(); it != a.end(); it++)
#define endl '\n'
#define y1 initialD
#define Okaay ios_base::sync_with_stdio(0)
#define letsGo cin.tie(NULL)
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(0);
clock_t startTime;
double getCurrentTime() {
return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
const int mod = 998244353;
const int INF = static_cast<int>(1e9) + 5;
const ll INF_64 = static_cast<ll>(2e18) + 5;
const ld eps = 1e-7;
const ld PI = acos(-1.0);
const char* filename = "improvements.in";
const char* filenameout = "improvements.out";
int add(int x, int y) { return (x + y) % mod; }
int sub(int x, int y) { return (x - y + mod) % mod; }
int mult(int x, int y) { return (x * 1ll * y) % mod; }
int binpow(int x, int exp)
{
if (exp < 0) return 1;
int ans = 1;
while (exp)
{
if (exp & 1) ans = mult(ans, x);
x = mult(x, x);
exp >>= 1;
}
return ans;
}
int del(int x, int y)
{
return mult(x, binpow(y, mod - 2));
}
void solve(int print = -1)
{
int n;
cin >> n;
vector<int> a;
while (n)
{
a.pb(n % 2);
n /= 2;
}
int cnt = 0;
for (int i = 0; i < a.size(); ++i)
{
if (!a[i]) ++cnt;
else
{
cout << cnt << endl;
return;
}
}
cout << cnt << endl;
return;
}
int naive(int print = -1)
{
return 0;
}
void read()
{
}
//void stress()
//{
// int cnt = 0;
// while (true)
// {
// if (cnt++ % 100 == 0)
// {
// cout << "Ok " << cnt << endl;
// }
// auto nRandom = uniform_int_distribution<int>(1, 1000);
// auto xRandom = uniform_int_distribution<int>(1, 1000000006);
// n = nRandom(rng);
// x = xRandom(rng);
// d = nRandom(rng);
// while (d > n)
// {
// d = nRandom(rng);
// }
// if (x == 27777500)
// x = xRandom(rng);
// initAB();
// if (naive() != solve())
// {
// auto s = solve();
// auto f = naive();
// cout << "Find\n";
// cout << "n " << n << endl;
// forn(i, n) cout << a[i] << ' ';
// cout << endl;
// forn(i, n) cout << b[i] << ' ';
// cout << endl;
// int missmatch = -1;
// forn(i, n)
// {
// if (s[i] != f[i])
// {
// missmatch = i;
// break;
// }
// }
// cout << "missmatch " << missmatch << endl;
// solve(missmatch);
// naive(missmatch);
// //cout << endl << "solve " << s << " naive " << f << endl;
// cin.get();
// solve();
// naive();
// }
// }
//}
int32_t main()
{
Okaay; letsGo;
cout.tie(NULL);
cout << setprecision(20) << fixed;
//#ifndef _DEBUG
//freopen(filename, "r", stdin);
// freopen(filenameout, "w", stdout);
//#endif // !
int T;
//stress();
T = 1;
//cin >> T;
while (T--)
{
read();
solve();
//cout << ((solve() == 1) ? "YES\n" : "NO\n"); // bool
//cout << solve() << endl;
}
}
Submission Info
Submission Time |
|
Task |
B - CTZ |
User |
Minder |
Language |
C++ 20 (gcc 12.2) |
Score |
200 |
Code Size |
4312 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
3604 KB |
Compile Error
Main.cpp: In function ‘void solve(int)’:
Main.cpp:93:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
93 | for (int i = 0; i < a.size(); ++i)
| ~~^~~~~~~~~~
Main.cpp:82:16: warning: unused parameter ‘print’ [-Wunused-parameter]
82 | void solve(int print = -1)
| ~~~~^~~~~~~~~~
Main.cpp: In function ‘int naive(int)’:
Main.cpp:106:15: warning: unused parameter ‘print’ [-Wunused-parameter]
106 | int naive(int print = -1)
| ~~~~^~~~~~~~~~
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
example_00.txt, example_01.txt, example_02.txt |
All |
example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt |
Case Name |
Status |
Exec Time |
Memory |
example_00.txt |
AC |
1 ms |
3468 KB |
example_01.txt |
AC |
1 ms |
3376 KB |
example_02.txt |
AC |
1 ms |
3448 KB |
hand_00.txt |
AC |
1 ms |
3388 KB |
hand_01.txt |
AC |
1 ms |
3600 KB |
hand_02.txt |
AC |
1 ms |
3476 KB |
hand_03.txt |
AC |
1 ms |
3420 KB |
hand_04.txt |
AC |
1 ms |
3456 KB |
hand_05.txt |
AC |
1 ms |
3380 KB |
hand_06.txt |
AC |
1 ms |
3416 KB |
random_00.txt |
AC |
1 ms |
3456 KB |
random_01.txt |
AC |
1 ms |
3480 KB |
random_02.txt |
AC |
1 ms |
3468 KB |
random_03.txt |
AC |
1 ms |
3452 KB |
random_04.txt |
AC |
1 ms |
3576 KB |
random_05.txt |
AC |
1 ms |
3320 KB |
random_06.txt |
AC |
1 ms |
3600 KB |
random_07.txt |
AC |
1 ms |
3468 KB |
random_08.txt |
AC |
1 ms |
3604 KB |
random_09.txt |
AC |
1 ms |
3416 KB |