#include <stdio.h>
int solve(int inputValue)
{
int iBuffer;
//1 : 6の倍数なら2で割った値を二乗した値
iBuffer = inputValue % 6;
if( 0 == iBuffer ){
iBuffer = inputValue / 2;
return ( iBuffer * iBuffer );
}else{
//2 : 3の倍数なら二乗した値
iBuffer = inputValue % 3;
if( 0 == iBuffer ){
return ( inputValue * inputValue );
}else{
//3: 2の倍数なら2で割った値
iBuffer = inputValue % 2;
if( 0 == iBuffer ){
return ( inputValue / 2 ); }
} }
//4: 上記以外の倍数は、二乗した値から元の値を引いた値
iBuffer = inputValue * inputValue - inputValue;
return iBuffer;
}
int main(int argc, char* argv[])
{
int iBuffer;
printf( "Answer %d\n", solve
( iBuffer
));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgc29sdmUoaW50IGlucHV0VmFsdWUpCgp7CglpbnQgaUJ1ZmZlcjsKCgkvLzEgOiA244Gu5YCN5pWw44Gq44KJMuOBp+WJsuOBo+OBn+WApOOCkuS6jOS5l+OBl+OBn+WApAoJaUJ1ZmZlciA9IGlucHV0VmFsdWUgJSA2OwoJCWlmKCAwID09IGlCdWZmZXIgKXsKCQkJaUJ1ZmZlciA9IGlucHV0VmFsdWUgLyAyOyAKCQlyZXR1cm4gKCBpQnVmZmVyICogaUJ1ZmZlciApOwoJCQl9ZWxzZXsgCgoJLy8yIDogM+OBruWAjeaVsOOBquOCieS6jOS5l+OBl+OBn+WApAoJaUJ1ZmZlciA9IGlucHV0VmFsdWUgJSAzOwoJCWlmKCAwID09IGlCdWZmZXIgKXsKCQkJcmV0dXJuICggaW5wdXRWYWx1ZSAqIGlucHV0VmFsdWUgKTsKCQkJfWVsc2V7IAoKCS8vM++8miAy44Gu5YCN5pWw44Gq44KJMuOBp+WJsuOBo+OBn+WApAoJaUJ1ZmZlciA9IGlucHV0VmFsdWUgJSAyOwoJCWlmKCAwID09IGlCdWZmZXIgKXsKCQkJcmV0dXJuICggaW5wdXRWYWx1ZSAvIDIgKTsgfQoJfSB9CgoJL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