text stringlengths 0 234 |
|---|
end if; |
Result := Vec.First_Element; |
Vec.Delete_First; |
return Result; |
end Pop; |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
File_Is_Empty : Boolean := True; |
Result : Natural := Natural'First; |
Result_List : List; |
Input : Vector; |
Output : Vector; |
begin |
Get_File (File); |
-- Get all values |
declare |
begin |
while not End_Of_File (File) loop |
declare |
Str : constant String := Get_Line (File); |
Last : Positive; |
Value : Natural; |
Snailfish_Number : List; |
begin |
for Char of Str loop |
case Char is |
when '[' => |
Snailfish_Number.Append (Opening_Bracket); |
when ']' => |
Snailfish_Number.Append (Closing_Bracket); |
when '0' .. '9' => |
Ada.Integer_Text_IO.Get (Char & "", Value, Last); |
Snailfish_Number.Append (Value); |
when others => |
null; |
end case; |
File_Is_Empty := False; |
end loop; |
Input.Append (Snailfish_Number); |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
package My_Coordinates is new Coordinates_2D (Integer); |
use My_Coordinates; |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
Result : Integer := Integer'First; |
X_Min, X_Max, |
Y_Min, Y_Max : Integer; |
begin |
Get_File (File); |
-- Get all values |
declare |
procedure Split_Range (Str : String; Lower, Upper : out Integer); |
procedure Split_Range (Str : String; Lower, Upper : out Integer) is |
use Ada.Integer_Text_IO; |
Pattern : constant String := ".."; |
Separator_Index : constant Natural := |
Ada.Strings.Fixed.Index (Source => Str, Pattern => Pattern); |
Left_Str : constant String := Str (Str'First .. Separator_Index - 1); |
Right_Str : constant String := Str (Separator_Index + Pattern'Length .. Str'Last); |
Last : Positive; |
begin |
Get (Left_Str, Lower, Last); |
Get (Right_Str, Upper, Last); |
end Split_Range; |
Str : constant String := Get_Line (File); |
Pattern : constant String := ","; |
Separator_Index : constant Natural := |
Ada.Strings.Fixed.Index (Source => Str (1 .. Str'Last), Pattern => Pattern); |
Left_Str : constant String := Str (16 .. Separator_Index - 1); |
Right_Str : constant String := Str (Separator_Index + Pattern'Length + 3 .. Str'Last); |
begin |
Split_Range (Left_Str, X_Min, X_Max); |
Split_Range (Right_Str, Y_Min, Y_Max); |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
package My_Coordinates is new Coordinates_2D (Integer); |
use My_Coordinates; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.