Skip to content

Commit 0e87f66

Browse files
authored
سوالات کوئرا
1 parent 66b0c74 commit 0e87f66

File tree

1 file changed

+23
-0
lines changed
  • پاسخ سوالات کوئرا/کوین و قذرت شالاپ

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import java.util.Scanner;
2+
3+
/**
4+
* Created by AMK on 7/28/2019.
5+
* Life is nice :)
6+
* Enjoy coding :D
7+
*/
8+
public class Main {
9+
public static void main(String[] args) {
10+
Scanner scanner = new Scanner(System.in);
11+
double n = scanner.nextInt();
12+
long sum = 0;
13+
for (int i = 0; i < n / 2; i++) {
14+
sum += i;
15+
}
16+
sum = sum * 2;
17+
if (n % 2 == 0){
18+
sum += n / 2;
19+
}
20+
n++;
21+
System.out.println(sum/n);
22+
}
23+
}

0 commit comments

Comments
 (0)