468 | 2021-11-03 17:37:44 | SzankaBenedek | Toronyépítés (1,1,3,3) | cpp11 | Compilation error |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int input;
cin >> input;
// int v[input];
// v[0] = 2;
// v[1] = 4;
// v[2] = 10; //8+2
// for (int n = 3; n < input; n++)
// {
// v[n] = (2 * v[n - 1] + 2 * v[n - 3]) % 20210108;
// }
// cout << v[input - 1] << "\n";
int a = 2;
int b = 4;
int c = 10;
for (int n = 3; n < input; n += 3)
{
a = (2 * c + 2 * a) % 20210108;
b = (2 * a + 2 * b) % 20210108;
c = (2 * b + 2 * c) % 20210108;
}
char asd = input % 3;
if (asd == 0)
{
cout << c << "\n";
return;
}
if (asd == 1)
{
cout << a << "\n";
return;
}
if (asd == 2)
{
cout << b << "\n";
return;
}
}
exit status 1main.cpp: In function ‘int main()’:
main.cpp:35:9: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
35 | return;
| ^~~~~~
main.cpp:40:9: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
40 | return;
| ^~~~~~
main.cpp:45:9: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
45 | return;
| ^~~~~~
Exited with error status 1