-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBerbalasPantun.cs
41 lines (33 loc) · 1.18 KB
/
BerbalasPantun.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
static void Main(string[] args)
{
/* Problem: Berbalas Pantun.
* Tingkatan: Penyisihan-(mudah)
* bahasa:c#
* Event:Gemastik 2017
* 0(n) -> big o notation just my guess ehehee
* kumpulan problem gemastik: https://tlx.toki.id/problems/gemastik-2017-pemrograman-penyisihan/A
*/
int[] A6 = new int[2];
int[] B6 = new int[2];
//A6 first
for(int x =0; x < A6.Length; x++)
{ Console.WriteLine("A6");
A6[x] = int.Parse(Console.ReadLine());
}
//B6
for (int x = 0; x < B6.Length; x++)
{
Console.WriteLine("B6");
B6[x] = int.Parse(Console.ReadLine());
}
//logic
var sum1 = A6.Sum();
var sum2 = B6.Sum();
var all = sum1 + sum2;
Console.WriteLine("Output:{0} ", all * 2); //kenapa dikali 2 ? karena dikasus ini N default adalah 2(sesuai ukuran array)
Console.ReadLine();
}