| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 391040 | RandomLB | 평균 (COCI14_prosjek) | C++17 | 1088 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef priority_queue<pi,vector<pi>,greater<pi>> djk;
#define pb push_back
#define ms(a,b) memset(a,b,sizeof(a));
#define maxE(a) *max_element(a, a+sizeof(a)/sizeof(a[0]))
int main(){
cin.tie(0)->sync_with_stdio(0);
string s;
cin >> s;
int dot = 0;
int k = s.length()-1;
bool good = false;
while (s[k] != '.'){
if (s[k] != '0' || good){
dot++;
good = true;
}
k--;
}
//cout << dot << endl;
ll j = 1;
ll num = 0;
good = false;
for (int i = (int)s.length()-1; i >= 0; i--){
if (i == k){continue;}
if (s[i] != '0' || good){
num += (s[i]-'0')*j;
j*=10;
good = true;
}
}
//cout << num << endl;
ll div = (ll)pow(10, dot);
good = false;
ll times = 1;
ll numT = num;
while (num % div != 0){
int n = num%10;
if (n != 0 && n % 2 == 0){
times *= 5;
num *= 5;
good = true;
} else if (n == 5){
times *= 2;
num *= 2;
good = true;
} else if (n != 0){
times *= 10;
num *= 10;
good = true;
} else if (good){
num *= 10;
times *= 10;
}
}
//cout << times << endl;
numT *= times;
numT /= div;
//cout << numT << endl;
ll arr[6];
ms(arr, 0);
int base = numT/times;
ll a = numT%times;
arr[base] = times-a;
arr[base+1] = a;
for (int i = 1; i <= 5; i++){
cout << arr[i] << ((i != 5)?" ":"");
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
