結果
問題 |
No.276 連続する整数の和(1)
|
ユーザー |
|
提出日時 | 2017-02-15 16:34:04 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 246 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-29 23:06:44 |
合計ジャッジ時間 | 790 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 7 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int sankaku(int x){return (x*(x+1))/2;} int gcd(int x,int y){int z;while(y){z=x%y;x=y;y=z;}return x;} int main(void) { int n; scanf("%d",&n); if(n <= 2){printf("1\n");} else{printf("%d\n",gcd(n,sankaku(n)));} return 0; }