結果
問題 |
No.31 悪のミックスジュース
|
ユーザー |
![]() |
提出日時 | 2014-12-03 00:23:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,066 bytes |
コンパイル時間 | 676 ms |
コンパイル使用メモリ | 85,640 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-11 07:56:01 |
合計ジャッジ時間 | 1,296 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:40:19: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=] 40 | scanf("%d%d", &N, &M); | ~^ ~~ | | | | int* ll* {aka long long int*} | %lld main.cpp:42:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=] 42 | scanf("%d", &sum[i + 1]); | ~^ ~~~~~~~~~~~ | | | | | ll* {aka long long int*} | int* | %lld main.cpp:40:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 40 | scanf("%d%d", &N, &M); | ~~~~~^~~~~~~~~~~~~~~~ main.cpp:42:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 42 | scanf("%d", &sum[i + 1]); | ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <cmath> #include <cstdio> #include <algorithm> #include <string> #include <vector> #include <queue> #include <string.h> #include <map> #include <fstream> #include <functional> #include <bitset> #include <iomanip> #include <stack> #include <set> #include <climits> #define MAX_N 510 #define PI 3.141592653589 #define ESP 1e-20 #define BS 10 #define MOD 1000000007 #define ZERO 10001 #define YJSNPI 810 #define INF (1LL << 50) #define ADD(a, b) a = (a + (ll)b) % MOD #define MUL(a, b) a = (a * (ll)b) % MOD #define MAX(a, b) a = max(a, b) #define MIN(a, b) a = min(a, b) using namespace std; typedef long long ll; typedef pair<int, int> pi; int N; ll M; ll sum[110]; int main() { scanf("%d%d", &N, &M); for(int i = 0; i < N; i++) { scanf("%d", &sum[i + 1]); sum[i + 1] += sum[i]; } M -= N; if(M <= 0) { cout << sum[N] << endl; return 0; } ll res = INF; for(int i = 1; i <= N; i++) { res = min(res, (M / i) * sum[i] + sum[M % i]); } cout << res + sum[N] << endl; }