Submission #3791598
Source Code Expand
#include <iostream> using namespace std; #define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MAX(x, y) ((x) > (y) ? (x) : (y)) #define DIVUP(x, y) (((x) + ((y) - 1)) / (y)) #define DIVOFF(x, y) (((x) + ((y) / 2)) / (y)) #define REMAINDER(x, y) ((x) % (y)) int main() { char ABCD[4+1]; scanf("%s", ABCD); for (int i{}; i < (1 << (4-1)); ++i) { int calc = ABCD[0] & 0xF; for (int j{}; j < (4-1); ++j) { if (i & (1 << j)) calc += ABCD[j+1] & 0xF; else calc -= ABCD[j+1] & 0xF; } if (calc == 7) { printf("%c", ABCD[0]); for (int j{}; j < (4-1); ++j) { printf("%c%c", (i & (1 << j)) ? '+' : '-', ABCD[j+1]); } printf("=7\n"); return 0; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Train Ticket |
User | tatsu |
Language | C++14 (Clang 3.8.0) |
Score | 300 |
Code Size | 780 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 888 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, sample_01.txt, sample_02.txt, sample_03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 7 ms | 888 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 1 ms | 256 KB |
07.txt | AC | 1 ms | 256 KB |
08.txt | AC | 1 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 1 ms | 256 KB |
11.txt | AC | 1 ms | 256 KB |
12.txt | AC | 1 ms | 256 KB |
13.txt | AC | 1 ms | 256 KB |
14.txt | AC | 1 ms | 256 KB |
15.txt | AC | 1 ms | 256 KB |
16.txt | AC | 1 ms | 256 KB |
sample_01.txt | AC | 1 ms | 256 KB |
sample_02.txt | AC | 1 ms | 256 KB |
sample_03.txt | AC | 1 ms | 256 KB |