#include <iostream>
#include <cstdio>
using namespace std;
bool numar(unsigned long long n)
{
return (n > 99) && ((n % 100) == 25);
}
int main()
{
freopen("numere.in", "r", stdin);
freopen("numere.out", "w", stdout);
int cnt = 0;
unsigned long long n, a, Nblabla, N;
while (scanf("%d", &n) == 1)
{
if (numar(n))
{
a = (n - 25) / 100;
cout << a; // This son of a *****.
for (N = 1; true; N++)
{
Nblabla = N * (N + 1);
if (Nblabla > a)
break;
else if (Nblabla == a)
{
cnt++;
}
}
}
}
printf("%d", cnt);
return 0;
}
簡単に言えば、その行 ( ) にコメントを付けるとcout << a;
、プログラムが動作しなくなります。そこに置いておけば、うまくいきます。
Code::Blocks、GNU GCC を使用しています。
これは、数値が digit で終わる数値の 2 乗であるかどうかをチェックするだけです5
。(基数 10) (平方根は使用できません)
質問する前に、いいえ、これは宿題ではありません。これは、オンライン コンテストの主題に対する私の提出物です。
なぜこれが起こっているのか誰にも教えてもらえますか?