提出 #30648426


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

int main() {
  long long N,K,X;
  cin>>N>>K>>X;
  vector<long long > A(N);
  for(long long y=0; y<N; y++){
    cin>>A[y];
  }
  long long O=0,S=0;
  for(long long e=0; e<N; e++){
    S+=A[e];
    O+=A[e]/X;
    A[e]=A[e]%X;
  }
  //cout<<O<<endl;
   long long P=0;
  sort(A.begin(),A.end());
  if(O>=K){
    cout<<S-X*K<<endl;
  }
  else{
    for(long long d=0; d<N-(K-O); d++){
      P+=A[d];
    }
    cout<<P<<endl;
  }
}

提出情報

提出日時
問題 C - Coupon
ユーザ yyk2111
言語 C++ (GCC 9.2.1)
得点 300
コード長 499 Byte
結果 AC
実行時間 87 ms
メモリ 4836 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 31
セット名 テストケース
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, example0.txt, example1.txt, example2.txt
ケース名 結果 実行時間 メモリ
000.txt AC 8 ms 3576 KiB
001.txt AC 79 ms 4600 KiB
002.txt AC 78 ms 4768 KiB
003.txt AC 77 ms 4604 KiB
004.txt AC 83 ms 4700 KiB
005.txt AC 83 ms 4744 KiB
006.txt AC 83 ms 4620 KiB
007.txt AC 87 ms 4740 KiB
008.txt AC 82 ms 4788 KiB
009.txt AC 79 ms 4732 KiB
010.txt AC 39 ms 4748 KiB
011.txt AC 39 ms 4832 KiB
012.txt AC 39 ms 4752 KiB
013.txt AC 39 ms 4604 KiB
014.txt AC 48 ms 3988 KiB
015.txt AC 75 ms 4516 KiB
016.txt AC 31 ms 3644 KiB
017.txt AC 83 ms 4836 KiB
018.txt AC 82 ms 4736 KiB
019.txt AC 82 ms 4648 KiB
020.txt AC 79 ms 4728 KiB
021.txt AC 76 ms 4748 KiB
022.txt AC 76 ms 4748 KiB
023.txt AC 79 ms 4744 KiB
024.txt AC 77 ms 4748 KiB
025.txt AC 79 ms 4752 KiB
026.txt AC 78 ms 4620 KiB
027.txt AC 80 ms 4676 KiB
example0.txt AC 2 ms 3576 KiB
example1.txt AC 2 ms 3412 KiB
example2.txt AC 4 ms 3484 KiB