chore: add remaining untracked files
This commit is contained in:
		
							
								
								
									
										2
									
								
								day_5/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								day_5/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
/.idea
 | 
			
		||||
/cmake-build-debug
 | 
			
		||||
							
								
								
									
										6
									
								
								day_5/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								day_5/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
cmake_minimum_required(VERSION 3.19)
 | 
			
		||||
project(day_5)
 | 
			
		||||
 | 
			
		||||
set(CMAKE_CXX_STANDARD 20)
 | 
			
		||||
 | 
			
		||||
add_executable(day_5 main.cpp)
 | 
			
		||||
							
								
								
									
										45
									
								
								day_5/main.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								day_5/main.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
struct Seat {
 | 
			
		||||
    uint32_t row;
 | 
			
		||||
    uint32_t column;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Seat getSeat(std::string &str) {
 | 
			
		||||
    Seat test = {};
 | 
			
		||||
    uint8_t hor_low = 0;
 | 
			
		||||
    uint8_t hor_high = 127;
 | 
			
		||||
 | 
			
		||||
    for (char c : str) {
 | 
			
		||||
        switch (c) {
 | 
			
		||||
            case 'F':
 | 
			
		||||
                uint8_t diff = hor_high - hor_low;
 | 
			
		||||
                hor_high -= diff;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'B':
 | 
			
		||||
                uint8_t diff = hor_high - hor_low;
 | 
			
		||||
                
 | 
			
		||||
                break;
 | 
			
		||||
            case 'L':
 | 
			
		||||
                break;
 | 
			
		||||
            case 'R':
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                throw std::exception {};
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return test;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
    std::string seat = "FBFBBFFRLR";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user