結果
| 問題 | No.72 そろばん Med | 
| コンテスト | |
| ユーザー |  notetonous | 
| 提出日時 | 2016-04-27 13:27:37 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 360 bytes | 
| コンパイル時間 | 243 ms | 
| コンパイル使用メモリ | 20,352 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-21 11:54:16 | 
| 合計ジャッジ時間 | 943 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%lld",&n);
      |   ^~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#define mod 1000007
int main(){
  long long int i,j;
  long long int n;
  long long int ans;
  long long int b,u;
  scanf("%lld",&n);
  if(n%2==1){
    b=(n/2+1)%mod;
    u=(n/2)%mod;
    ans=u*(b+1);
    ans=ans+b;
  }
  else {
    b=(n/2)%mod;
    u=(n/2)%mod;
    ans=u*(b+1);
    ans=ans+b;
  }
  printf("%lld\n",ans%mod);
  return 0;
}
            
            
            
        