| 25057 | 2026-02-17 16:45:23 | szabelr | Kedves számok | cpp17 | Compilation error |
// Kedves számok DP.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
string s;
cin >> s;
int l = s.size();
long long sum = 1;
for (int i = 1; i < l; i++)
{
sum += pow(2, i - 1);
}
bool tight = true;
for (int i = 0; i < l; i++)
{
if (i == 0)
{
tight = false;
int d = s[i] - '0';
if(3<d)
sum=pow(2, l - i - 1);
if (d == 3)
tight = true;
}
else
{
tight = false;
int d = s[i] - '0';
if (0 < d)
{
sum += pow(2, l - i - 1);
}
if (3 < d)
{
sum += pow(2, l - i - 1);
}
if (d == 3 or d == 0)
tight = true;
if (!tight)
break;
}
}
if (tight) sum++;
cout << sum;
}
open /var/local/lib/isolate/404/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:17:16: error: 'pow' was not declared in this scope
17 | sum += pow(2, i - 1);
| ^~~
main.cpp:27:21: error: 'pow' was not declared in this scope
27 | sum=pow(2, l - i - 1);
| ^~~
main.cpp:37:24: error: 'pow' was not declared in this scope
37 | sum += pow(2, l - i - 1);
| ^~~
main.cpp:41:24: error: 'pow' was not declared in this scope
41 | sum += pow(2, l - i - 1);
| ^~~