Professional Documents
Culture Documents
Sim 2024 Galați
Sim 2024 Galați
//1.
#include <iostream>
using namespace std;
//3.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream f("tombola.out");
int x, i, s[501], nr = 0;
s[1] = 1;
cin >> x;
if (x == 1)
f << "Ai castigat";
else
{
for (i = 2; i < 501; ++i)
{
if (i % 2 == 0)
s[i] = (i - 1) * (i - 1) + 3;
else
s[i] = s[i - 1] + 1;
if (s[i] == x)
nr++;
}
if (nr != 0)
f << "Ai castigat";
else
f << "Necastigator";
}
f.close();
return 0;
}