結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             startcpp
                         | 
                    
| 提出日時 | 2022-01-22 14:49:36 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 383 bytes | 
| コンパイル時間 | 480 ms | 
| コンパイル使用メモリ | 65,992 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-27 11:49:33 | 
| 合計ジャッジ時間 | 1,268 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 | 
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int x, y, l;
	cin >> x >> y >> l;
	
	int cntx = (abs(x) + l - 1) / l;
	int cnty = (abs(y) + l - 1) / l;
	int rot;
	
	if (y > 0) {
		if (x == 0) rot = 0;
		else rot = 1;
	}
	else if (y == 0) {
		if (x == 0) rot = 0;
		else rot = 1;
	}
	else {
		rot = 2;
	}
	
	cout << cntx + cnty + rot << endl;
	return 0;
}
            
            
            
        
            
startcpp