Submission #20547262
Source Code Expand
Copy
#include <bits/stdc++.h>using namespace std;long long score(vector<int>deck) {int num[10] = {0};for(int i=0; i<5; i++)num[deck[i]]++;long long score = 0;for(int i=1; i<=9; i++) {long long p = 1;for(int j=0; j<num[i]; j++) p *= 10;score += i*p;}return score;}int main() {int k;char s[6], t[6];scanf("%d%s%s",&k, s, t);int num[10];for(int i=1; i<=9; i++)num[i] = k;vector<int>ss, tt;
#include <bits/stdc++.h> using namespace std; long long score(vector<int>deck) { int num[10] = {0}; for(int i=0; i<5; i++) num[deck[i]]++; long long score = 0; for(int i=1; i<=9; i++) { long long p = 1; for(int j=0; j<num[i]; j++) p *= 10; score += i*p; } return score; } int main() { int k; char s[6], t[6]; scanf("%d%s%s",&k, s, t); int num[10]; for(int i=1; i<=9; i++)num[i] = k; vector<int>ss, tt; for(int i=0; i<4; i++) { ss.push_back(s[i] - '0'); num[s[i]-'0']--; tt.push_back(t[i] - '0'); num[t[i]-'0']--; } long long nn = 0ll, dd = 0ll; for(int i=1; i<=9; i++) { for(int j=1; j<=9; j++) { vector<int>new_ss = ss; new_ss.push_back(i); vector<int>new_tt = tt; new_tt.push_back(j); long long score_s = score(new_ss); long long score_t = score(new_tt); long long cur; if (i==j) cur = num[i] * (num[j] - 1); else cur = num[i] * num[j]; if (score_s > score_t) { nn += cur; } dd += cur; } } cout<<(long double)nn/(long double)dd<<endl; }
Submission Info
Submission Time | |
---|---|
Task | E - Oversleeping |
User | albert0liu0 |
Language | C++ (GCC 9.2.1) |
Score | 0 |
Code Size | 1298 Byte |
Status | RE |
Exec Time | 116 ms |
Memory | 3372 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] 18 | scanf("%d%s%s",&k, s, t); | ~~~~~^~~~~~~~~~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 01_sample.txt |
All | 01_sample.txt, 02_hand.txt, 03_hand.txt, 04_small.txt, 05_small.txt, 06_small.txt, 07_small.txt, 08_small.txt, 09_inf.txt, 10_inf.txt, 11_inf.txt, 12_large.txt, 13_large.txt, 14_large.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01_sample.txt | RE | 116 ms | 3288 KB |
02_hand.txt | RE | 109 ms | 3148 KB |
03_hand.txt | RE | 109 ms | 3156 KB |
04_small.txt | RE | 111 ms | 3368 KB |
05_small.txt | RE | 107 ms | 3360 KB |
06_small.txt | RE | 109 ms | 3360 KB |
07_small.txt | RE | 109 ms | 3372 KB |
08_small.txt | RE | 109 ms | 3244 KB |
09_inf.txt | RE | 108 ms | 3300 KB |
10_inf.txt | RE | 108 ms | 3288 KB |
11_inf.txt | RE | 110 ms | 3200 KB |
12_large.txt | RE | 108 ms | 3252 KB |
13_large.txt | RE | 108 ms | 3288 KB |
14_large.txt | RE | 108 ms | 3356 KB |