結果

問題 No.2424 Josouzai
コンテスト
ユーザー nekoti
提出日時 2023-08-18 21:10:23
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 620 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 167 ms
コンパイル使用メモリ 38,976 KB
最終ジャッジ日時 2026-02-22 11:10:55
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>
#include<stdlib.h>
//■ライブラリ
#define _SORT_TYPE long
int ascsort(const void * n1, const void * n2){if(*(_SORT_TYPE *)n1>*(_SORT_TYPE *)n2)return 1;else if (*(_SORT_TYPE *)n1<*(_SORT_TYPE *)n2)return -1;else return 0;}//昇順ソート
int main(void)
{
  int scan;//scanf警告用
  long long ans=0;
  int i, j;
  
  int n,k;
  scan=scanf("%d",&n);
  scan=scanf("%d",&k);
  _SORT_TYPE a[n];
  for(i=0; i<n; i++)scan=scanf("%ld",&a[i]);
  qsort(a, n, sizeof(_SORT_TYPE), ascsort);
  for(i=0; i<n; i++)
  {
  	ans+=a[i];
  	if(k<=ans)break;
  }
  printf("%d %lld", i, k-ans+a[i]);
  return 0;
}
0