Search is not available for this dataset
name
stringlengths 2
112
| description
stringlengths 29
13k
| source
int64 1
7
| difficulty
int64 0
25
| solution
stringlengths 7
983k
| language
stringclasses 4
values |
|---|---|---|---|---|---|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int x;
cin >> x;
printf("%d", 6 * x * (x - 1) + 1);
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
o = n * (n - 1) * 6 + 1
print(o)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
long long ans = 1;
long long tambah = 3;
for (int i = 1; i < n; i++) {
ans += (tambah * 6);
ans -= 6;
tambah += 2;
}
cout << ans << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
int r = 0;
for (int i = 1; i < a; i++) {
r += i;
}
cout << 1 + r * 12 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int a, ans = 1;
cin >> a;
for (int i = 1; i <= a; ++i) ans += (i - 1) * 12;
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
while (t--) solve();
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
int main() {
int n, count = 1;
scanf("%d", &n);
if (n >= 2) count += 12;
for (int i = 3; i <= n; i++) {
count += 12 * (i - 2) + 12;
}
printf("%d", count);
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Locale;
import java.util.StringTokenizer;
public class B {
private void solve() throws IOException {
int n = nextInt();
int res = 1;
for (int i = 1; i < n; i++) {
res += 12 * i;
}
println(res);
}
private String nextToken() throws IOException {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
private int nextInt() throws NumberFormatException, IOException {
return Integer.parseInt(nextToken());
}
private double nextDouble() throws NumberFormatException, IOException {
return Double.parseDouble(nextToken());
}
private long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
private void print(Object o) {
writer.print(o);
}
private void println(Object o) {
writer.println(o);
}
private void printf(String format, Object... o) {
writer.printf(format, o);
}
public static void main(String[] args) {
long time = System.currentTimeMillis();
Locale.setDefault(Locale.US);
new B().run();
System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time));
}
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter writer;
private void run() {
try {
reader = new BufferedReader(new InputStreamReader(System.in));
writer = new PrintWriter(System.out);
solve();
reader.close();
writer.close();
} catch (IOException e) {
e.printStackTrace();
System.exit(13);
}
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int a[19000];
int main() {
int ans = 1;
int n;
cin >> n;
int cur = 12;
for (int i = 1; i < n; i++) {
ans += cur;
cur += 12;
}
cout << ans;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class B {
private StreamTokenizer in;
private PrintWriter out;
public static void main (String[] args) throws IOException {
new B().solve();
}
int nextInt () throws IOException {
in.nextToken();
return (int)in.nval;
}
void solve () throws IOException {
in = new StreamTokenizer(new BufferedReader(/*new FileReader("./src/uva/p10003/input.txt")*/ new InputStreamReader(System.in)));
out = new PrintWriter(new OutputStreamWriter(System.out));
int a = nextInt();
if (a == 1) {
out.print(1);
out.flush();
return;
}
int sum = 1;
for (int i = 2; i <= a; i++) {
sum += ((i * 2 - 2) * 6);
sum %= 2000000000;
}
out.print(sum);
out.flush();
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
const double eps = 1e-10;
using namespace std;
int dblcmp(double x) {
if (fabs(x) < eps) return 0;
return x > 0 ? 1 : -1;
}
int main() {
int i, j, k, n;
int a, b;
string s;
while (cin >> a) {
k = 1;
for (i = 1; i < a; ++i) k += 12 * i;
cout << k << endl;
}
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.*;
import java.util.*;
public class b{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int s = 1;
for(int i = 2; i <= n; i++){
s += 12 * (i-1);
}
System.out.println(s);
}
}
//n** {{1}}
//n** {{2}}
//n** {{3}}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
# Author : raj1307 - Raj Singh
# Date : 01.02.2020
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def msi(): return map(str,input().strip().split(" "))
def li(): return list(mi())
def dmain():
sys.setrecursionlimit(100000000)
threading.stack_size(40960000)
thread = threading.Thread(target=main)
thread.start()
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading
#from itertools import permutations
#Copy 2D list m = [x[:] for x in mark] .. Avoid Using Deepcopy
abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
inf = float("inf")
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[1]
def sort2(l):return sorted(l, key=getKey,reverse=True)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]
def powerMod(x,y,p):
res = 1
x %= p
while y > 0:
if y&1:
res = (res*x)%p
y = y>>1
x = (x*x)%p
return res
def gcd(x, y):
while y:
x, y = y, x % y
return x
def isPrime(n) : # Check Prime Number or not
if (n <= 1) : return False
if (n <= 3) : return True
if (n % 2 == 0 or n % 3 == 0) : return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
def read():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
def ncr(n, r, p):
# initialize numerator
# and denominator
num = den = 1
for i in range(r):
num = (num * (n - i)) % p
den = (den * (i + 1)) % p
return (num * pow(den,
p - 2, p)) % p
def main():
#for _ in range(ii()):
n=ii()
print(6*n*(n-1)+1)
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
"""Prints the values to a stream, or to sys.stdout by default."""
sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
at_start = True
for x in args:
if not at_start:
file.write(sep)
file.write(str(x))
at_start = False
file.write(kwargs.pop("end", "\n"))
if kwargs.pop("flush", False):
file.flush()
if sys.version_info[0] < 3:
sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# endregion
if __name__ == "__main__":
#read()
main()
#dmain()
# Comment Read()
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
cout << 6 * n * (n - 1) + 1 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
def triangle(n):
return n*(n+1)//2
def hexagon(n):
return 6*triangle(n) - 6*n + 1
n = int(input())
print(2*triangle(3*n - 2) - hexagon(n))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
public class Task171B {
public static void main(String... args) throws NumberFormatException,
IOException {
Solution.main(System.in, System.out);
}
static class Scanner {
private final BufferedReader br;
private String[] cache;
private int cacheIndex;
Scanner(InputStream is) {
br = new BufferedReader(new InputStreamReader(is));
cache = new String[0];
cacheIndex = 0;
}
int nextInt() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return Integer.parseInt(cache[cacheIndex++]);
}
long nextLong() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return Long.parseLong(cache[cacheIndex++]);
}
double nextDouble() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return Double.parseDouble(cache[cacheIndex++]);
}
String next() throws IOException {
if (cacheIndex >= cache.length) {
cache = br.readLine().split(" ");
cacheIndex = 0;
}
return cache[cacheIndex++];
}
void close() throws IOException {
br.close();
}
}
static class Solution {
public static void main(InputStream is, OutputStream os)
throws NumberFormatException, IOException {
PrintWriter pw = new PrintWriter(os);
Scanner sc = new Scanner(is);
int a = sc.nextInt();
pw.println(1 + 6 * (a - 1) * a);
pw.flush();
sc.close();
}
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << n * 6 * (n - 1) + 1 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
int main() {
long long a, x = 1;
scanf("%lld", &a);
for (long long int i = 1; i <= a; i++) x += 9 * (i - 1) + 3 * (i - 1);
printf("%lld\n", x);
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
int main() {
int i, n, sum = 13;
scanf("%d", &n);
if (n == 1) {
printf("%d", 1);
return 0;
}
if (n == 2) {
printf("%d", 13);
return 0;
}
for (i = 3; i <= n; i++) {
sum = sum + (2 * i - 2) * 6;
}
printf("%d", sum);
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.Scanner;
public class b171 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
System.out.println(6 * n * (n - 1) + 1);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
print(1+6*n*(n-1))
# Made By Mostafa_Khaled
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#In the name of Allah
from sys import stdin, stdout
input = stdin.readline
a = int(input())
ans = 1
for i in range(1, a):
ans += 6 * (2 * i)
stdout.write(str(ans))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class FirstApril2012 {
void solve () throws IOException {
int a = in.nextInt();
int f[] = new int[a + 10];
f[1] = 1;
f[2] = 1 + 6 + 6;
int p = 3;
for (int i = 3; i <= a; i++){
f[i] = f[i - 1] + p * 6 + 6;
p += 2;
}
out.println(f[a]);
}
String input = "";
String output = "";
FastScanner in;
PrintWriter out;
void run () {
try {
BufferedReader bf;
if (input.length() == 0)
bf = new BufferedReader(new InputStreamReader(
System.in));
else
bf = new BufferedReader(new FileReader(input));
in = new FastScanner(bf);
if (output.length() == 0)
out = new PrintWriter(System.out);
else
out = new PrintWriter(new File(output));
solve();
out.close();
} catch (Exception ex) {
out.close();
ex.printStackTrace();
}
}
public static void main (String[] args) {
new FirstApril2012().run();
}
class FastScanner {
BufferedReader bf;
StringTokenizer st;
FastScanner(BufferedReader bf) {
this.bf = bf;
}
String next () throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(bf.readLine());
return st.nextToken();
}
int nextInt () throws IOException {
return Integer.parseInt(next());
}
long nextLong () throws IOException {
return Long.parseLong(next());
}
double nextDouble () throws IOException {
return Double.parseDouble(next());
}
int[] readIntArray (int n) throws IOException {
int a[] = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long[] readLongArray (int n) throws IOException {
long a[] = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
print(6 * n * (n - 1) + 1)
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
def init():
a = int(raw_input())
return int(a)
def solve(n):
a = (3 * n - 2) * (3 * n - 1) / 2
b = 3 * n * (n - 1) + 1
return 2 * a - b
if __name__ == "__main__":
a = init()
print solve(a)
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
print( 1+sum([12*(i-1) for i in range(2,n+1)]))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
cout << 1 + 12 * n * (n - 1) / 2 << endl;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
int a = 1 + 12 * (n * (n - 1) / 2);
cout << a;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
public class Problem0171b {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(triangular(n-1)*4 + (n*2-1)*(n*2-1));
}
public static int triangular(int n) {
if(n == -1) {
return 0;
}
int sum = 0;
for(int i = 1; i <= n; i++) {
sum+=i;
}
return sum;
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
template <typename T>
T inline SQR(const T &a) {
return a * a;
}
template <typename T>
T inline ABS(const T &a) {
return a < 0 ? -a : a;
}
const double EPS = 1e-9;
inline int SGN(double a) {
return ((a > EPS) ? (1) : ((a < -EPS) ? (-1) : (0)));
}
inline int CMP(double a, double b) { return SGN(a - b); }
using namespace std;
int main(int argc, char *argv[]) {
ios::sync_with_stdio(false);
long long n;
cin >> n;
cout << (6LL * n * n - 6LL * n + 1LL) << "\n";
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int depth, solution = 1;
cin >> depth;
for (int size = 12; depth > 1; --depth, size += 12) solution += size;
cout << solution << "\n";
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Star {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
long n = Long.parseLong(bf.readLine());
System.out.println(6 * n * (n - 1) + 1);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a;
cin >> a;
if (a == 1LL) {
cout << 1;
return 0;
}
--a;
long long res = (3LL * a + 2LL) * (3LL * a + 1LL) / 2LL;
res += 3LL * a * (a + 1LL) / 2LL;
cout << res << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
int n;
int main() {
scanf("%d", &n);
printf("%d", 1 + 6 * n * ~-n);
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.*;
import java.util.*;
public class Solution {
public static StringTokenizer tok = null;
public static BufferedReader cin;
public static String nextToken() throws Exception {
if (tok == null || !tok.hasMoreTokens()) {
tok = new StringTokenizer(cin.readLine());
}
return tok.nextToken();
}
public static int nextInt() throws Exception {
return Integer.parseInt(nextToken());
}
public static double nextDouble() throws Exception {
return Double.parseDouble(nextToken());
}
public static void main(String[] args) throws Exception {
cin = new BufferedReader(new InputStreamReader(System.in));
int n = nextInt();
long sum = 0;
for (int i = 1; i <= n; i++) {
if (i == 1) {
sum++;
} else {
sum += 6 * (i + i - 2);
}
}
System.out.println(sum);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a;
cin >> a;
cout << (1 + 12 * a * (a - 1) / 2) << endl;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import sys
a = input()
s = 1
if a == 1: print s; sys.exit(0)
for i in range(2,a+1):
s += 6*(i-1)*2
print s
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Star {
static BufferedReader in;
static PrintWriter out;
static StringTokenizer tok;
static int nextInt() throws IOException {
return parseInt(next());
}
static long nextLong() throws IOException {
return parseLong(next());
}
static double nextDouble() throws IOException {
return parseDouble(next());
}
static String next() throws IOException {
while (tok == null || !tok.hasMoreTokens()) {
tok = new StringTokenizer(in.readLine());
}
return tok.nextToken();
}
public static void main(String[] args) {
try {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(new OutputStreamWriter(System.out));
solve();
in.close();
out.close();
} catch (Throwable e) {
e.printStackTrace();
exit(1);
}
}
private static void solve() throws IOException {
int a = nextInt();
int res = 1;
int tmp = 0;
for (int i = 0; i < a; i ++) {
res += tmp;
tmp += 12;
}
System.out.println(res);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;
public class Star {
public static void main(String[] args) {
InputStream in = System.in;
PrintStream out = System.out;
Scanner input = new Scanner(in);
int a = input.nextInt();
if(a == 1) {
out.println(1);
}else {
int f = 6 * a * (a - 1) + 1;
out.println(f);
}
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = input()
result = 6*n*n - 6*n + 1
print result
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
long long qpow(long long a, long long b) {
long long s = 1;
while (b > 0) {
if (b % 2 == 1) {
s = s * a;
}
a = a * a;
b = b >> 1;
}
return s;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
long long n, ans = 1;
cin >> n;
if (n == 1) {
cout << 1;
} else {
long long t = 1;
for (int i = 1; i < n; i++) {
ans = ans + t * 6 + 6;
t += 2;
}
cout << ans << '\n';
}
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n == 1)
cout << 1;
else {
long long res = 13, s = 12;
for (int i = 3; i <= n; ++i) {
s += 12;
res += s;
}
cout << res;
}
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m = 0;
cin >> n;
for (int i = 1; i < n; i++) {
m += i;
}
if (n == 1) {
cout << 1;
return 0;
}
long long y = (2 * n + (n - 2)) * (2 * n + (n - 1));
y = y / 2;
cout << y + 3 * m;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin >> n;
long long int ans = 0;
for (long long int i = 0; i < n; i++) {
ans += 12 * i;
}
cout << ans + 1;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int a, res, i, side, cnt;
int main() {
cin >> a;
cnt = 0;
if (a == 1)
res = 1;
else {
res = 1;
side = 1;
for (i = 1; i < a; i++) {
side += 3;
res += side * 3;
if (i > 1) res += cnt * 3;
cnt++;
}
}
cout << res << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
print(n * (n - 1) * 6 + 1)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
public class Star {
public static void main(String[] args){
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
long[] memo = new long[n+1];
memo[1] = 1;
for(int i = 2; i <= n; i++)
memo[i] = memo[i-1] + 12l*(i-1);
System.out.println(memo[n]);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
public class B {
public static void main(String[] args) {
long r = 1;
for (long n = new Scanner(System.in).nextLong(); n-- > 1;) {
r += 12 * n;
}
System.out.println(r);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long n;
cin >> n;
cout << 6 * n * (n - 1) + 1 << '\n';
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
public class a {
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int n;
n=scan.nextInt();
System.out.println(6*n*(n-1)+1);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
public static int MOD = 1000000007;
public static BigInteger big_mod = BigInteger.valueOf(MOD);
static List<Long> list = new ArrayList<Long>();
public static void main(String[] args) throws NumberFormatException,
IOException {
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));
int N = Integer.parseInt(in.readLine());
System.out.println((N * N - 1) * 4 + 4*((N-1) * (N-2))/2 + 1);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.*;
import java.util.*;
import java.math.*;
public class Codeforces implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
Random rnd;
void solve() throws IOException {
int n = nextInt();
int res = 6 * n * (n - 1) + 1;
out.println(res);
}
public static void main(String[] args) {
new Thread(null, new Codeforces(), "yarrr", 1 << 24).start();
}
public void run() {
try {
final String className = this.getClass().getName().toLowerCase();
try {
in = new BufferedReader(new FileReader(className + ".in"));
out = new PrintWriter(new FileWriter(className + ".out"));
} catch (FileNotFoundException e) {
in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);
}
rnd = new Random();
solve();
out.close();
} catch (IOException e) {
e.printStackTrace();
System.exit(42);
}
}
String nextToken() throws IOException {
while (st == null || !st.hasMoreTokens()) {
String line = in.readLine();
if (line == null) {
return null;
}
st = new StringTokenizer(line);
}
return st.nextToken();
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
'''
Created on Apr 22, 2013
@author: ola
'''
def ps(x):
total = 1
while x > 1:
total += (2*x - 1)*6 - 6
x = x - 1
return total
def solve():
line = raw_input()
data = line.split()
x = int(data[0])
if x == 1:
print 1
else:
print ps(x)
if __name__ == '__main__':
solve()
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskB solver = new TaskB();
solver.solve(1, in, out);
out.close();
}
}
class TaskB {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
long cur = 1;
int i = 1;
while (n-- > 0) {
cur += i * 6 - 6 ;
i += 2;
}
out.println(cur);
}
}
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class T171B {
public void solve(int n) {
long[] ans = new long[18258];
ans[1] = 1;
ans[2] = 12;
for (int i = 3; i < 18258; i ++)
ans[i] = ans[i - 1] + 12;
long sum = 0;
for (int i = 1; i <= n; i ++)
sum += ans[i];
System.out.println(sum);
}
public static void main(String[] args) {
FastScanner in = new FastScanner();
new T171B().solve(in.nextInt());
}
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner(String s) {
try {
br = new BufferedReader(new FileReader(s));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String nextToken() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(nextToken());
}
long nextLong() {
return Long.parseLong(nextToken());
}
double nextDouble() {
return Double.parseDouble(nextToken());
}
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int a[18257 + 5] = {0, 1, 13, 37, 73}, n;
int main() {
cin >> n;
for (int i = 5; i <= n; i++) {
a[i] = a[i - 1] + (a[i - 1] - a[i - 2] + 12);
}
cout << a[n];
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
int n;
cin >> n;
cout << 6 * (n * (n - 1)) + 1 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
//2021 B
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int caseNum = 1;
for (int ks = 1; ks <= caseNum; ks++) {
System.out.println(new Solution().solve(input));
}
}
public long solve(Scanner scanner) {
int n = scanner.nextInt();
long ans = 1;
for(int i = 2;i<=n;i++){
ans+=((i-1)*12);
}
return ans;
}
/*
- The following are helping method so pls do not do anything to them.
*/
public static int[][] to2d(Scanner scanner, int m, int n){
int[][] ans = new int[m][n];
for(int i = 0;i<m;i++){
String[] r = scanner.nextLine().split("[ ]");
for(int j = 0;j<n;j++){
ans[i][j] = stoi(r[j]);
}
}
return ans;
}
public static int[] toArray(Scanner scanner, int m){
int[] ans = new int[m];
String[] r = scanner.nextLine().split("[ ]");
for(int i = 0;i<m;i++){
ans[i] = stoi(r[i]);
}
return ans;
}
public static void printArr(int[] a){
for(int i = 0;i<a.length;i++){
System.out.print(a[i]);
if(i!=a.length-1){
System.out.print(" ");
}
}
}
public static void print2d(int[][] a){
for(int j=0;j<a.length;j++){
for(int i = 0;i<a[j].length;i++){
System.out.print(a[j][i]);
if(i!=a[j].length-1){
System.out.print(" ");
}
}
System.out.println(" ");
}
}
public static int stoi(String s){
return Integer.parseInt(s);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
public class b {
/**
* @param args
*/
static Scanner in=new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
int n=in.nextInt();
int ans=1;
for(int i=1;i<n;i++){
ans+=6*(2*i);
}
System.out.println(ans);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a;
cin >> a;
cout << 6 * a * (a - 1) + 1 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
int main() {
int n, t(0), r(1);
std::cin >> n;
for (int i(0); i < n; ++i) {
r += t;
t += 12;
}
std::cout << r << std::endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:260108864")
using namespace std;
int main() {
int n;
scanf("%d", &n);
int res(1);
int temp(1);
while (--n) {
res += temp * 12;
++temp;
}
printf("%d\n", res);
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.*;
import java.util.*;
public class B {
public void solve() throws IOException {
int n = nextInt();
int ans = 1;
for (int i = 2; i <= n; i++) {
ans += (2 * i - 2) * 6;
}
writer.println(ans);
}
public static void main(String[] args) throws FileNotFoundException {
new B().run();
}
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter writer;
public void run() {
try {
long tbegin = System.currentTimeMillis();
reader = new BufferedReader(new InputStreamReader(System.in));
//reader = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
tokenizer = null;
writer = new PrintWriter(System.out);
//writer = new PrintWriter(new FileOutputStream("output.txt"));
solve();
//reader.close();
//System.out.println(System.currentTimeMillis() - tbegin + "ms");
writer.close();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
long nextLong() throws IOException {
return Long.parseLong(nextToken());
}
double nextDouble() throws IOException {
return Double.parseDouble(nextToken());
}
String nextToken() throws IOException {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
int main() {
int x;
scanf("%d", &x);
printf("%d\n", 6 * x * (x - 1) + 1);
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
do
{
long n = input.nextLong();
long resultado = (((3*n-1)*(3*n-2)+(n)*(n-1)*3)/2);
System.out.println(resultado);
}while(input.hasNext());
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
S = 1 + 12 * n * (n - 1) / 2
print(int(S))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << (n * (n - 1) * 6 + 1);
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n=int(input())
print(1+6*(n*(n-1)))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
cout << 6 * (n * (n - 1)) + 1 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import sys
import copy
from collections import Counter
sys.setrecursionlimit(11111)
import re
import itertools
n = int(sys.stdin.readline().strip())
print 6 * n * (n-1) + 1
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double INC_EPS = 1e-7;
const int N = 1e5 + 5;
int main() {
int n;
long long ans = 0, k = 2;
cin >> n;
for (int i = 2; i <= n; i++) {
ans += k * 6;
k += 2;
}
cout << ans + 1;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << (2 * n - 1) * (2 * n - 1) + 4 * (n - 1) * n / 2;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
long long factorial(long long n) {
if (n == 1) return 1;
return n * factorial(n - 1);
}
long long max(long long a, long long b) { return (a > b ? a : b); }
long long min(long long a, long long b) { return (a < b ? a : b); }
using namespace std;
void impossible() {
long long n;
cin >> n;
long long p = 12, i = 0;
long long ans = 1;
if (n == 1) {
cout << "1";
return;
}
while (n--) {
ans += 12 * i++;
}
cout << ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long t = 1;
while (t--) impossible();
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.*;
public class sad {
public static void main(String[] args)
{
Scanner inp=new Scanner(System.in);
int i=1,n,cnt=0,x=1;
n=inp.nextInt();
for(i=1;i<n;i++)
{
cnt=cnt+12*i;
}
System.out.println(cnt+1);
// <3 #pn #bff
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
long long n, ans = 1;
int main() {
cin >> n;
for (int i = 2; i <= n; i++) {
ans += ((i - 1) * 12);
}
cout << ans;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.io.*;
import java.util.*;
public class Tasks {
public static void main(String[] args) throws IOException {
new Tasks().runMain();
}
void runMain() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n == 1) System.out.print(1);
else if(n == 2) System.out.print(13);
else {
int i = 3, starC = 5, starT = 13;
while (i <= n) {
starT += (6 * starC - 6);
starC += 2;
i++;
}
System.out.print(starT);
}
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.Scanner;
public class AprilB {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = 1;
for (int i = 1; i < n; i++) {
x= x+12*i;
}
System.out.println(x);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n=int(input())
a=3*n-2
b=n-1
print(int((a*(a+1))/2 + ((b*(b+1))/2)*3))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
n = int(input())
print(int((2*n-1)*(2*n-1)+4*(n-1)*(n)/2))
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, t(1);
cin >> n;
for (int i = 0; i < (int)n; i++) t += (12 * i);
cout << t;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:64000000")
using namespace std;
int main() {
long long out = 0, a, b;
cin >> a;
if (a == 1)
out = 1;
else {
out = 1;
b = 12;
for (int i = 1; i < a; i++) {
out += b;
b += 12;
}
}
cout << out;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
## DATA SOURCE (1 for file, 0 for std input)
opt = 0
src = opt and open("input", "r") or None
def gvals(source, format = int, separator = ' '):
if source:
a = map(format, source.readline().split(separator))
else:
a = map(format, raw_input().split(separator))
return a
def gval(source, format = int):
if source:
a = format(source.readline())
else:
a = format(raw_input())
return a
a = gval(src)
t = [6*(x) for x in range(a)]
t[0]=1
print sum(t)+6*sum(range(a))
|
PYTHON
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
long long star[18528];
int main() {
long long i;
long long k = 1, z = 4;
long long a;
star[1] = 1;
for (i = 2; i <= 18527; i++) {
star[i] = (z * (z + 1)) / 2 + 3 * k;
k = k + i;
z = z + 3;
}
cin >> a;
cout << star[a] << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long pw(long long a, long long b) {
long long r = 1;
while (b > 0) {
if (b & 1) {
r = (r * a) % MOD;
}
b = b >> 1;
a = (a * a) % MOD;
}
return (r) % MOD;
}
int f[18259];
int main() {
f[0] = 0;
f[1] = 1;
for (int i = 2; i < 18258; i++) {
f[i] = (12 * (i - 1)) + f[i - 1];
}
int a;
scanf("%d", &a);
printf("%d", f[a]);
printf("\n");
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << n * (n - 1) * 6 + 1;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
a = int(input())
k = 1
p = 12
for i in range(a - 1):
k += p
p += 12
print(k)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
r=1
for i in range(int(input()),1,-1):
r+=6*((i-1)*2)
print(r)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
print(sum((i - 1) * 12 for i in range(1, int(input()) + 1)) + 1)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a;
cin >> a;
cout << 6 * a * (a - 1) + 1 << endl;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
long long t;
int main() {
scanf("%d", &t);
printf("%d", 6 * t * (t - 1) + 1);
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.Scanner;
public class alalal2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int sayi = input.nextInt();
int x=sayi;
int b=0;
int result=0;
if(sayi>1){
for(int a=1;a<x;a++){
result=(sayi-1)*12;
sayi--;
b=b+result;
}
}
else{
result=0;
}
System.out.println(b+1);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) {
return {l.first + r.first, l.second + r.second};
}
typedef void (*callback_function)(void);
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const long long INF32 = 1e9;
const long long MOD = 1e9 + 7;
const long double PI = acos(-1.0L);
const long double EPS = static_cast<long double>(1e-9);
long long inv(long long a, long long b) {
if (a != 1) {
return b - (inv(b % a, a) * b) / a;
}
return 1;
}
inline long long Pow(long long a, long long k) {
long long s = 1;
for (; k; k >>= 1) {
k& 1 ? s = 1LL * s * a % MOD : 0;
a = 1LL * a * a % MOD;
}
return s;
}
const long long N = 1e6 + 7;
void input() {}
void output() {}
void preprocess() {}
void debug() {
if (true) {
}
}
void solve() {
preprocess();
long long n;
cin >> n;
long long res = 1;
for (long long i = (1); i < (n); i++) {
res += i * 12;
}
cout << res << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie();
{
input();
solve();
output();
}
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
long long estella(int n);
using namespace std;
long long b, a;
int main() {
cin >> a;
cout << estella(a);
return 0;
}
long long estella(int n) {
if (n == 1) {
b = 1;
} else {
b = 2 * (n - 1) * (n - 1) + 2 * n * n + 2 * n * n - 2 * n - 1;
}
return b;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#star noumber problem
# 1 13....
n=int(input())
k=6*n;k1=n-1;ans=k*k1
print(ans+1)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
IOI=int(input())
print(IOI*(IOI-1)*6+1)
|
PYTHON3
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
long long n;
int sum = 1;
int main() {
cin >> n;
for (int i = 1; i < n; i++) sum += i * 12;
cout << sum;
return 0;
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
// practice with kaiboy
import java.io.*;
import java.util.*;
public class CF171B extends PrintWriter {
CF171B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF171B o = new CF171B(); o.main(); o.flush();
}
int triangle(int n) {
return n * (n + 1) / 2;
}
int hexagon(int n) {
return triangle(n) * 6 - n * 6 + 1;
}
void main() {
int n = sc.nextInt();
println(triangle(n * 3 - 2) * 2 - hexagon(n));
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
printf("%d", 6 * n * (n - 1) + 1);
}
|
CPP
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
import java.util.Scanner;
public class Main {
static long sol;
static int a;
public static void main(String[] args) {
Scanner l = new Scanner(System.in);
a=l.nextInt();
sol=6*a*(a-1)+1;
System.out.println(sol);
}
}
|
JAVA
|
171_B. Star
|
<image>
Input
The input contains a single integer a (1 ≤ a ≤ 18257).
Output
Print a single integer output (1 ≤ output ≤ 2·109).
Examples
Input
2
Output
13
| 2
| 8
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << 6 * n * (n - 1) + 1;
}
|
CPP
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.