結果

問題 No.111 あばばばば
ユーザー naimonon77
提出日時 2015-10-09 14:21:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 422 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-20 02:22:05
合計ジャッジ時間 554 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |   scanf("%lld",&n);
      |   ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
/* 入力開始! */
/* 入力終了! */
int main(void)
{
  int i,j;
  ll n;
  scanf("%lld",&n);
  ll k = (n-2)/2;
  ll ans = k*(k+1);
  if((n-2) % 2) ans += k+1;
  printf("%lld\n",ans);
 
  return 0;
}
0