QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#606631 | #6431. Oops, It's Yesterday Twice More | S_zhi# | WA | 0ms | 3640kb | C++14 | 928b | 2024-10-03 11:05:33 | 2024-10-03 11:05:34 |
Judging History
answer
#include <iostream>
using namespace std ;
int main(){
int n , a , b ; cin >> n >> a >> b ;
/*
U
L R
D
*/
int ansx = 1 , ansy = 1 ;
if((a - 1) + (b - 1) <= n - 1){
ansx = 1 , ansy = 1 ;
for(int i = 1 ; i < n ; i ++ ) cout << "UL" ;
}else if((a - 1) + (n - b) <= n - 1){
ansx = 1 , ansy = n ;
for(int i = 1 ; i < n ; i ++ ) cout << "DL" ;
}else if((n - a) + (b - 1) <= n - 1){
ansx = n , ansy = 1 ;
for(int i = 1 ; i < n ; i ++ ) cout << "UR" ;
}else{
ansx = n , ansy = n ;
for(int i = 1 ; i < n ; i ++ ) cout << "DR" ;
}
while(ansx != a){
if(ansx < a) ansx ++ , cout << "R" ;
else ansx -- , cout << "L" ;
}
while(ansy != b){
if(ansy < b) ansy ++ , cout << "D" ;
else ansy -- , cout << "U" ;
}
return 0 ;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
3 3 3
output:
DLDLRR
result:
ok n=3, x=3, y=3
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3640kb
input:
4 3 2
output:
ULULULRRD
result:
wrong answer Failed