#30590: 答案 和 解法


allenwu981002@gmail.com (貓帥帥)


 輸入 x 後
                     算出  x * (x - 1) +2

答案:  

include<iostream>
using namespace std;
int main()
{
    {
         int x;  
         while (cin >> x)
        {

         cout << x * (x - 1) + 2 <<"\n";
        }
}
}

#33020: Re: 答案 和 解法


a110608@ctes.ylc.edu.tw (鍾均)


 輸入 x 後
                     算出  x * (x - 1) +2

答案:  

include
using namespace std;
int main()
{
    {
         int x;  
         while (cin >> x)
        {

         cout << x * (x - 1) + 2 <<"\n";
        }
}
}


如果遇到1就會錯了