提出 #70218850


ソースコード 拡げる

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#ifdef jlocal
#include<jdebug/debug.hpp>
#else
#define debug(...) 0;
#endif

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#if defined(__LP64__) || defined(_WIN64)
typedef __int128 lll;
#else
typedef long long lll;
#endif

#define pcount(x) __builtin_popcount(x)
#define pcountll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()

const ld pi = 3.14159265358979323846L;
const ld sqrt2 = 1.41421356237309504880L;

template<class T>
istream& operator>>(istream& in, vector<T> &a){
	for (int i = 0; i < a.size(); i ++)
		in >> a[i];
	return in;
}

template<class T>
ostream& operator<<(ostream& out, vector<T> &a){
	for (int i = 0; i < a.size(); i ++){
		if (i > 0) out << ' ';
		out << a[i];
	}
	return out;
}

#if defined(__LP64__) || defined(_WIN64)

istream& operator>>(istream& in, __int128 &x){
	string S;
	in >> S;
	for (char &y : S){
		x *= 10;
		x += (y - '0');
	}
	return in;
}

ostream& operator<<(ostream& out, __int128 &x){
	string s;
	while(x > 0){
		s.push_back((x % 10) + '0');
		x /= 10;
	}
	if (s.size() == 0)
		s.push_back('0');
	reverse(all(s));
	return out << s;
}

#endif

mt19937_64 MT64;
void pre_init() {
	MT64 = mt19937_64(chrono::system_clock::now().
	time_since_epoch().count());
}

void solve(int caso){
	ll S, A, B, X;
	cin >> S >> A >> B >> X;
	ll C = A + B;
	ll total = (X / C) * S * A;
	X = X % C;
	X = min(A, X);
	total += S * X;
	cout << total << '\n';
}

int main(){
#ifndef jlocal
	ios::sync_with_stdio(0); cin.tie(0);
#endif
	pre_init();

	int t = 1;
	for (int i = 1; i <= t; i ++){
		solve(i);
	}
	return 0;
}

提出情報

提出日時
問題 A - Grandma's Footsteps
ユーザ JOliva
言語 C++ 20 (gcc 12.2)
得点 150
コード長 2030 Byte
結果 AC
実行時間 1 ms
メモリ 3600 KiB

コンパイルエラー

Main.cpp: In function ‘void solve(int)’:
Main.cpp:82:16: warning: unused parameter ‘caso’ [-Wunused-parameter]
   82 | void solve(int caso){
      |            ~~~~^~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 150 / 150
結果
AC × 3
AC × 18
セット名 テストケース
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt
ケース名 結果 実行時間 メモリ
00-sample-01.txt AC 1 ms 3444 KiB
00-sample-02.txt AC 1 ms 3512 KiB
00-sample-03.txt AC 1 ms 3376 KiB
01-01.txt AC 1 ms 3468 KiB
01-02.txt AC 1 ms 3472 KiB
01-03.txt AC 1 ms 3468 KiB
01-04.txt AC 1 ms 3464 KiB
01-05.txt AC 1 ms 3516 KiB
01-06.txt AC 1 ms 3524 KiB
01-07.txt AC 1 ms 3444 KiB
01-08.txt AC 1 ms 3476 KiB
01-09.txt AC 1 ms 3512 KiB
01-10.txt AC 1 ms 3468 KiB
01-11.txt AC 1 ms 3476 KiB
01-12.txt AC 1 ms 3592 KiB
01-13.txt AC 1 ms 3448 KiB
01-14.txt AC 1 ms 3600 KiB
01-15.txt AC 1 ms 3520 KiB