Source
stringclasses
1 value
Date
int64
2.01k
2.02k
Text
stringlengths
22
783k
Token_count
int64
20
394k
Project_CodeNet
2,018
#include <bits/stdc++.h> using namespace std; int N, a[2][102], dp[2][102]; int func(int r, int c){ if(r == 1 && c == N - 1) return a[r][c]; int &ret = dp[r][c]; if(ret != -1) return ret; ret = 0; if(r < 1) ret = func(r + 1, c) + a[r][c]; if(c < N - 1) ret = max(ret, func(r, c + 1) + a[r][c]); return ret; } in...
204
Project_CodeNet
2,019
#include<bits/stdc++.h> using namespace std; typedef long long unsigned int ll; // definition {{{ 1 // scaning {{{ 2 #define Scd(x) scanf("%d", &x) #define Scd2(x,y) scanf("%d%d", &x, &y) #define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z) #define Scll(x) scanf("%llu", &x) #define Scll2(x,y) scanf("%llu%llu", &x, &y) #d...
456
Project_CodeNet
2,019
#include <iostream> #include <vector> #include <string> #include <numeric> using namespace std; int main(void){ // Your code here! int a; std::cin >> a; int ame1[100]; int ame2[100]; for(int i=0; i < a; i++){ cin >> ame1[i]; } for(int i=0; i < a; i++){ cin ...
189
Project_CodeNet
2,019
i{for(;--i;t<s&&t=s)s-=A[i]-$i}c++{for(;A[i]=$++i;)s+=$i}$0=t
36
Project_CodeNet
2,018
structure A = Array structure T = TextIO structure SC = StringCvt fun nextInt () = valOf (T.scanStream (Int.scan SC.DEC) T.stdIn) fun scan rdr strm = SOME (SC.splitl (not o Char.isSpace) rdr (SC.skipWS rdr strm)) fun next () = valOf (T.scanStream scan T.stdIn) fun input (ary, n) = let val i = ref 0 in ...
374
Project_CodeNet
2,019
#include<stdio.h> int main(void){ char *s="python3 -c\"" "n,*a=map(int,open(0).read().split());print(max(sum(a[:i+1]+a[n+i:])for i in range(n)))\n" "\""; system(s); return 0; }
70
Project_CodeNet
2,019
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++...
339
Project_CodeNet
2,018
function Main(input) { input = input.split("\n"); var a1 = input[1].split(' ').map(e => { return parseInt(e) }) var a2 = input[2].split(' ').map(e => { return parseInt(e) }) var j = a1.length - 1 var m = 0, n = a1.length - 2 var r = 0; var temp; for (var i = j; i >= m; i--) { temp =...
206
Project_CodeNet
2,018
fun main(args: Array<String>) { val n = readLine()!!.toInt() val x1s = readLine()!!.split(" ").map(String::toInt) val x2s = readLine()!!.split(" ").map(String::toInt) val ans = (1..n).map { x1s.subList(0, it).sum() + x2s.subList(it - 1, n).sum() }.max() println(ans) }
100
Project_CodeNet
2,018
private fun readLineStrings(): List<String> = readLine()!!.split(" ") private fun readLineInts(): List<Int> = readLineStrings().map { it.toInt() } private fun List<Int>.firstLineCumulativeCandy(): List<Int> { var tempSum = 0 return this.map { tempSum += it tempSum } } private fun List<Int>...
210
Project_CodeNet
2,018
fun main(args: Array<String>) { val n = readLine()!!.toInt() val aList = mutableListOf<List<Int>>() aList.add(readLine()!!.split(' ').map(String::toInt)) aList.add(readLine()!!.split(' ').map(String::toInt)) var max = 0 for (i in 0 until n) { val temp = aList[0].filterIndexed { index, i...
135
Project_CodeNet
2,018
module Main where import Data.List(zipWith) int = read :: String -> Int replace pred a = map (\x -> if pred x then a else x) main = interact $ printer . solver . parser parser = map (map int . words) . lines printer = unlines . (:[]) . show solver :: [[Int]] -> Int solver [ns,a1,a2] = last b2 where n = head ns ...
145
Project_CodeNet
2,018
main :: IO () main = do n <- readLn :: IO Int as1 <- sum' <$> getInts as2 <- reverse . sum' . reverse <$> getInts -- print as1 -- print as2 print $ solve n as1 as2 getInts :: IO [Int] getInts = map read . words <$> getLine solve n as1 as2 = maximum $ flip map [0..n - 1] $ \i ->...
124
Project_CodeNet
2,018
import Control.Monad (forM_) solve [_] _ maxans = maxans solve ((_,a10):(a01,a11):as) ans maxans = solve ((a01,a11):as) newans $ max maxans newans where newans = ans+a01-a10 main :: IO () main = do n <- read <$> getLine :: IO Int a1s <- map read.words <$> getLine :: IO [Int] a2s <- map read.words <$> getLine...
152
Project_CodeNet
2,018
sumN :: [Int] -> [Int] -> Int -> Int sumN a1s a2s n = s1 + s2 where s1 = sum (take (n + 1) a1s) s2 = sum (drop n a2s) solve :: Int -> [Int] -> [Int] -> Int solve valN a1s a2s = maximum (map (sumN a1s a2s) [0 .. valN-1]) main :: IO () main = do cont <- getContents let valN : as = map read (words cont)...
174
Project_CodeNet
2,020
main=do getLine a<-map read.words<$>getLine b<-map read.words<$>getLine let s=sum b print$maximum$f s$zip a b f s[]=[] f s((a,b):x)=s+a:f(s+a-b)x
61
Project_CodeNet
2,020
main = do n <- readLn a1n <- map read . words <$> getLine a2n <- map read . words <$> getLine print $ maximum [sum(take i a1n) + sum(drop (i-1) a2n) | i <- [1..n]]
69
Project_CodeNet
2,018
import Debug.Trace main = do _ <- read <$> getLine :: IO Int a1s <- map read . words <$> getLine :: IO [Int] a2s <- map read . words <$> getLine :: IO [Int] print $ solve a1s a2s solve :: [Int] -> [Int] -> Int solve a1s a2s = -- traceShow cumsum1 -- traceShow cumsum2 -- traceShow candidate ans where ...
208
Project_CodeNet
2,018
import Control.Monad main :: IO () main = do n <- readLn :: IO Int as <- replicateM 2 $ fmap (map read . words) getLine ans <- fmap maximum $ forM [0..n-1] $ \i -> do return $ sum $ take (i+1) (as !! 0) ++ drop i (as !! 1) print ans
89
Project_CodeNet
2,018
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE BangPatterns #-} import Control.Applicative import Control.Monad import Control.Arrow import Data.List import Data.Maybe import Data.Char import qualified Data.ByteString.Char8 as B import Text.Printf readInt = ( readLn :: IO Int ) readInts = map ( read :: String -> I...
190
Project_CodeNet
2,018
import Data.Array.IO main = do n <- readLn a <- map read . words <$> getLine :: IO [Int] b <- map read . words <$> getLine :: IO [Int] let ans = solve n [a,b] 1 (n - 1) print ans solve :: Int -> [[Int]] -> Int -> Int -> Int solve n a i j = if i < 0 || j < 0 then 0 else (a !! i...
141
Project_CodeNet
2,018
main = do getLine a <- map read . words <$> getLine b <- map read . words <$> getLine print $ maximum $ zipWith (+) (scanl1 (+) a) (scanr1 (+) b)
55
Project_CodeNet
2,018
main :: IO () main = do getLine a1 <- map read . words <$> getLine a2 <- map read . words <$> getLine let po = sum $ init a2 a = zip (tail a1) (init a2) sums = scanl1 (\(x1, y1) (x2, y2) -> (x1 + x2, y1 + y2)) a ans = foldl (\x (y, z) -> (y + po - z) : x) [] sums print $ head a1 + last a2 + if...
149
Project_CodeNet
2,018
import Data.Array import Data.List main = do n <- read <$> getLine :: IO Int ns <- listArray ((1,1), (2,n)) . map read . words <$> getContents :: IO (Array (Int, Int) Int) print $ dp ns dp :: Array (Int, Int) Int -> Int dp ns = memo!(1,1) where (_,(_,xe)) = bounds ns memo = array ((1,1),(2,xe)...
226
Project_CodeNet
2,018
import Data.List main = do n <- readLn :: IO Int a <- map read . words <$> getLine :: IO [Int] b <- reverse . map read . words <$> getLine :: IO [Int] let ans = maximum $ map (solve a b n) [1..n] print ans solve :: [Int] -> [Int] -> Int -> Int -> Int solve a b n i = let aS = sum $ take i a bS = sum ...
127
Project_CodeNet
2,020
?k??zR[rdSA+zK<xddlM>MsMLA-zR+]dsxxlMp
25
Project_CodeNet
2,020
let N = Int(readLine()!)! var A = [[Int]]() for _ in stride(from: 0, to: 2, by: 1) { let row = readLine()!.split(separator: " ").map { Int($0)! } A.append(row) } var dp = Array(repeating: Array(repeating: 0, count: N), count: 2) for j in stride(from: 0, to: N, by: 1) { for i in stride(from: 0, to: 2, by: ...
268
Project_CodeNet
2,019
object Main extends App { import scala.io.StdIn._ val n = readInt val line1 = readLine.trim.split(' ').map(_.toInt) val line2 = readLine.trim.split(' ').map(_.toInt) for (i ← line1.indices.tail) line1(i) += line1(i - 1) for (i ← line2.indices.reverse.tail) line2(i) += line2(i + 1) println( line1.zip(...
122
Project_CodeNet
2,018
object Main { def main(args: Array[String]): Unit = { val n = io.StdIn.readLine().toInt val a1 = io.StdIn.readLine().split(' ').map { _.toInt } val a2 = io.StdIn.readLine().split(' ').map { _.toInt } val b1 = a1.drop(1).scanLeft(a1(0))((a,b) => a+b) val b2 = a2.take(n-1).scanRight(a2(n-1))((a,b) ...
141
Project_CodeNet
2,018
import java.io.{BufferedReader, InputStream, InputStreamReader, PrintWriter} import java.util.StringTokenizer import scala.collection.mutable import scala.util.Sorting import math.{abs, max, min} import scala.collection.mutable.{ArrayBuffer, ListBuffer} import scala.reflect.ClassTag object Main { val MOD = 10000000...
486
Project_CodeNet
2,020
object Main extends App { val sc = new java.util.Scanner(System.in) val n = sc.nextInt() val a1, a2 = Array.fill(n)(sc.nextInt()) val b1 = a1.scanLeft(0)(_ + _).tail val b2 = a2.scanRight(0)(_ + _).init val ans = b1.zip(b2).map{case (x, y) => x + y}.max println(ans) }
102
Project_CodeNet
2,018
let () = let n = Scanf.scanf "%d\n" (fun n -> n) in let ue = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in let shita = Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in for i = 1 to n - 1 do ue.(i) <- ue.(i) + ue.(i - 1) done; for i = n - 2 downto 0 do shita.(i) <- shita.(i) + sh...
183
Project_CodeNet
2,020
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n let a = Array.init 2 @@ fun _ -> read_line () |> split_string ~pattern:" " |> List.map int_of_string |> Array.of_list let () = for i = 1 to n - 1 do a.(0).(i) <- a.(0).(i - 1) + a.(0).(i) done; a...
190
Project_CodeNet
2,019
Imports System.Console Imports System.Math Module Program Sub Main() Dim N As Integer = Console.ReadLine() Console.Error.WriteLine(N) ' Dim A(2,N) As Integer Dim A(,) As Integer = New Integer(2,N) {} For i As Integer = 0 To 1 Dim tmp As String() = Console.ReadLine(...
366
Project_CodeNet
2,018
fn get_line() -> String { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().to_string() } fn reads<T>() -> Vec<T> where T: std::str::FromStr, <T as std::str::FromStr>::Err: std::fmt::Debug { get_line().split(' ').map(|x| x.parse().unwrap()).collect() } fn...
337
Project_CodeNet
2,018
#![allow(unused_macros, unused_imports, dead_code)] use std::io; fn read_line() -> String { let mut s = String::new(); io::stdin().read_line(&mut s).unwrap(); s } macro_rules! from_line { ($($a:ident : $t:ty),+) => { $(let $a: $t;)+ { let _line = read_line(); l...
263
Project_CodeNet
2,018
use std::io; use std::cmp; /// https://beta.atcoder.jp/contests/arc090/tasks/arc090_a fn main() { let n = read_one::<usize>(); let mut an = Vec::new(); for _ in 0..2 { an.push(read::<usize>()); } let mut ans = 0; for i in 0..n { let mut cnt = 0; for j in 0..n + 1 { ...
302
Project_CodeNet
2,019
fn read<T: std::str::FromStr>() -> Vec<T> { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).ok(); buf.split_whitespace() .map(|x| x.parse().ok().unwrap()) .collect() } fn main() { let n: usize = read()[0]; let a: Vec<usize> = read(); let b: Vec<usize> = read();...
165
Project_CodeNet
2,018
fn main() { let n: usize = readln(); let a: Vec<i64> = readln(); let b: Vec<i64> = readln(); let ans = (0..n) .map(|i| a[0..i + 1].iter().sum::<i64>() + b[i..n].iter().sum::<i64>()) .max() .unwrap(); println!("{}", ans); } // --- template --- #[allow(unused_imports)] use std...
599
Project_CodeNet
2,019
use std::io; use std::cmp; fn main() { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); let N: usize = iter.next().unwrap().parse().unwrap(); let mut A: Vec<Vec<i32>> = Vec::new(); for i in 0..2 { let mut vec: Vec<i3...
373
Project_CodeNet
2,019
use std::cmp::max; // ref. https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let s = { use std::io::Read; let mut s ...
540
Project_CodeNet
2,018
#[allow(unused_macros)] macro_rules! get { ([$t:ty] ; $n:expr) => { (0..$n) .map(|_| get!([$t])).collect::<Vec<_>>() }; ($($t:ty),+ ; $n:expr) => { (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>() }; ([$t:ty]) => { rl().split_whitespace() .map(|x| x.parse()....
483
Project_CodeNet
2,018
use std::cmp; fn main() { let n = read_values::<usize>()[0]; let a = (0..2).map(|_| read_values::<usize>()).collect::<Vec<_>>(); let mut dp = vec![vec![0; n]; 2]; dp[0][0] = a[0][0]; for i in 1..n { dp[0][i] = dp[0][i - 1] + a[0][i]; } dp[1][0] = dp[0][0] + a[1][0]; for i in 1.....
283
Project_CodeNet
2,020
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut n...
598
Project_CodeNet
2,019
use std::cmp; fn main() { let s = std::io::stdin(); let mut sc = Scanner { stdin: s.lock() }; let n = sc.read(); let a = (0..2).map(|_| sc.vec::<usize>(n)).collect::<Vec<_>>(); let mut dp = vec![vec![0; n]; 2]; dp[0][0] = a[0][0]; dp[1][0] = dp[0][0] + a[1][0]; for i in 1..n { ...
430
Project_CodeNet
2,020
use proconio::input; // ordtools {{{ mod ordtools { pub trait Ordtools: PartialOrd + Clone + Sized { fn change_min(&mut self, rhs: &Self) { if rhs < self { *self = rhs.clone(); } } fn change_max(&mut self, rhs: &Self) { if rhs > self { ...
214
Project_CodeNet
2,018
/** * _ _ __ _ _ _ _ _ _ _ * | | | | / / | | (_) | (_) | | (_) | | * | |__ __ _...
1,136
Project_CodeNet
2,018
#![allow(unused_imports, unused_macros, unknown_lints)] use std::collections::*; use std::cmp::Ordering::*; macro_rules! dump {($($e:expr), +) => {print!(concat!($(stringify!($e), " = {:?}\n"), +), $($e), +)}} macro_rules! max {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::max(r, $e);)+ r}}} macro_r...
1,251
Project_CodeNet
2,019
use std::io::stdin; use std::str::FromStr; use std::cmp::max; fn main(){ let n: usize = get_one(); let xs: Vec<i64> = get_vec(); let ys: Vec<i64> = get_vec(); let cxs = cumsum(xs); let cys = cumsum(ys); let mut ans = 0; for i in 0..n { let candy = cxs[i+1] - cys[i] + cys.last().unwr...
430
Project_CodeNet
2,018
use std::cmp; struct Solver { w: i32, cells: Vec<Vec<i32>>, } impl Solver { fn new() -> Solver { let w = read(); let h = 2; Solver { w: w, cells: read_lines(h), } } fn run(&self) { let mut best = 0; // 最も良いルートを探索 for...
395
Project_CodeNet
2,018
#![allow(unused_imports, unused_macros, dead_code)] use std::f64::*; use std::cmp::*; use std::collections::*; macro_rules! dump{ ($($a:expr),*) => { println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*); } } const INF: i64 = 0x3f3f3f3f3f3f3f3f; const MOD: i64 = 1000000007; const NOTHING: usize...
729
Project_CodeNet
2,019
#[allow(unused_macros)] macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io...
675
Project_CodeNet
2,018
use std::str::FromStr; use std::io::*; use std::cmp::*; pub fn main() { let i = stdin(); let mut o = Vec::new(); run(&mut i.lock(), &mut o); stdout().write_all(&o).unwrap(); } fn run<R: BufRead, W: Write>(i: &mut R, o: &mut W) { let mut i = AtRead::from(i); let n = i.read::<usize>(); let m...
418
Project_CodeNet
2,018
import * as fs from "fs"; let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n"); const n = +input[0]; const a0 = input[1].split(" ").map((x: string): number => +x); const a1 = input[2].split(" ").map((x: string): number => +x); const s0: number[] = []; for (let i = 0; i < n; i++) { if (i === 0) ...
251
Project_CodeNet
2,018
<?php fscanf(STDIN,"%d",$N); $A = []; for($i = 1; $i<=2; $i++){ $arr = explode(" ",trim(fgets(STDIN))); foreach($arr as $key =>$elem){ $A[$i][$key+1] = $elem; } unset($arr); } $count = 0; $max = 0; //$indexは下に移動するindexを指す for($index = 1; $index <=$N; $index++){ for($i = 1; $i<= $index; $i++){ $...
203
Project_CodeNet
2,020
<?php $tmp = []; while ($line = fgets(STDIN)) { $tmp[] = trim($line); } $N = $tmp[0]; $A_list[] = explode(' ', $tmp[1]); $A_list[] = explode(' ', $tmp[2]); // x座標,y座標,合計 $dp[0][] = [0, 0, $A_list[0][0]]; for ($i = 0; $i < $N; $i++) { $count = count($dp[$i]); for ($p = 0; $p < $count; $p++) { $...
379
Project_CodeNet
2,018
<?php fscanf(STDIN, "%d", $w); $maxSum = 0; $nums1 = explode(" ", fgets(STDIN)); $nums2 = explode(" ", fgets(STDIN)); for($i = 0; $i < $w; $i++){ $sum = 0; for($j = 0; $j < $w; $j++){ if($j <= $i)$sum+=$nums1[$j]; if($j >= $i)$sum+=$nums2[$j]; } $maxSum = max($sum, $maxSum); } echo $maxSum;
133
Project_CodeNet
2,018
package main import ( "bufio" "os" "strconv" "fmt" ) func main() { sc.Split(bufio.ScanWords) N := nextInt() a1 := nextIntArray(N) a2 := nextIntArray(N) res := 0 for i := 0; i < N; i++ { cur := 0 for j := 0; j <= i; j++ { cur += a1[j] } for j := i; j < N; j++ { cur += a2[j] } res = max(res...
440
Project_CodeNet
2,019
package main import "fmt" func max(a, b int) int { if a > b { return a } return b } func main() { var n int fmt.Scan(&n) a := make([][]int, 3) for i := 0; i <= 2; i++ { a[i] = make([]int, n+5) } for i := 1; i <= 2; i++ { for j := 1; j <= n; j++ { fmt.Scan(&a[i][j]) } } dp := make([][]int, 3)...
267
Project_CodeNet
2,018
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { sc := NewScanner() N := sc.NextInt() A := make([][]int, 2) A[0] = sc.NextIntArray() A[1] = sc.NextIntArray() dp := make([][]int, 2) for i := 0; i < 2; i++ { dp[i] = make([]int, N) } dp[0][0] = A[0][0] for i := 1; i < N; i++ { dp[0][...
884
Project_CodeNet
2,018
package main import "fmt" const MAXN = 110 func main() { var N int fmt.Scanf("%d\n", &N) var a [2][MAXN]int for j := 0; j < 2; j++ { for i := 0; i < N; i++ { fmt.Scanf("%d", &a[j][i]) } } ret := 0 for i := 0; i < N; i++ { score := 0 for j := 0; j < N; j++ { if j <= i { score += a[0][j] ...
189
Project_CodeNet
2,018
package main import ( "fmt" "io" "os" ) func parse(r io.Reader) [2][]int { var N int fmt.Fscan(r, &N) var a [2][]int for i := 0; i < 2; i++ { a[i] = make([]int, N) for j := 0; j < N; j++ { fmt.Fscan(r, &a[i][j]) } } return a } func calc(a [2][]int) int { N := len(a[0]) max := 0 for i := 0; i <...
232
Project_CodeNet
2,019
package main import ( "bufio" "fmt" "os" "strconv" "strings" ) const size = 1000000 var reader = bufio.NewReaderSize(os.Stdin,size) func NextLine() string { var line,buffer []byte var isPrefix bool = true var err error for ;isPrefix; { line,isPrefix,err = reader.ReadLine() if err != nil { pa...
323
Project_CodeNet
2,019
package main import ( "bufio" "fmt" "io" "os" "strconv" ) var sc = NewScanner(os.Stdin, 1000000) var A1 []int var A2 []int var N int var max int func main() { max = 0 N = sc.readInt() A1 = []int{} A2 = []int{} for i := 0; i < N; i++ { A1 = append(A1, sc.readInt()) } for i := 0; i < N; i++ { A2 = app...
330
Project_CodeNet
2,018
#include <stdio.h> int main(void){ int i, j, max, sum, N, A[2][100] = {{0}}; scanf("%d", &N); for(i=0;i<N;i++)scanf("%d", &(A[0][i])); for(i=0;i<N;i++)scanf("%d", &(A[1][i])); max = 0; for(i=0;i<N;i++){ sum = 0; for(j=0;j<N;j++){ if(j<=i)sum+=A[0][j]; if(i...
165
Project_CodeNet
2,018
#include<stdio.h> int main(){ int n,a[2][100],i,sum=0,max=0,j; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[0][i]); for(i=0;i<n;i++) scanf("%d",&a[1][i]); for(i=0;i<n;i++){ sum=0; for(j=0;j<n;j++){ if(j<=i) sum+=a[0][j]; ...
150
Project_CodeNet
2,018
/* ============================================================================ Name : ARC_090_C.c Author : Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include <stdio.h...
323
Project_CodeNet
2,018
#include <stdio.h> #include <string.h> #define ll long long #define rep(i,l,r)for(ll i=(l);i<(r);i++) #define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k)) #define INF ((1LL<<62)-(1LL<<31)) #define max(p,q)((p)>(q)?(p):(q)) #define min(p,q)((p)<(q)?(p):(q)) ll a[110]; ll b[110]; ll ans; int main(){ ll n; scanf("%lld",&n);...
199
Project_CodeNet
2,019
#include <stdio.h> int cmpfunc (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } int main() { int n, ar[110], br[110], cr[110], sum, temp, i, j, k, c=0; scanf("%d", &n); for (i=0; i<n; i++) scanf("%d", &ar[i]); for (i=0; i<n; i++) scanf("%d", &br[i]); for(i=0;...
217
Project_CodeNet
2,018
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(void) { int n; int max = 0; int a[2][100]; int i, j; int sum[2] = { 0 }; int sum0; scanf("%d", &n); for (i = 0; i < 2; ++i){ for (j = 0; j < n; ++j){ scanf("%d", &a[i][j]); sum[i] += a[i][j]; } } sum0 = a[0][0] + sum[1]; for (i = 0; i < n;...
193
Project_CodeNet
2,018
#include <stdio.h> int A[2][100],dp[2][100]; int max(int a,int b){return (a>b)?a:b;} int main() { int N,i,j; scanf("%d",&N); for(i=0;i<2;i++) { for(j=0;j<N;j++) scanf("%d",&A[i][j]); } for(i=0;i<2;i++) { for(j=0;j<N;j++) { dp[i][j]=A[i][j]; if(...
199
Project_CodeNet
2,019
#include<stdio.h> int main() { int n,arr[2][105],max=0,i,j,a,b,c; scanf("%d",&n); for(i=0; i<2; i++) { for(j=0; j<n; j++) { scanf("%d",&arr[i][j]); } } for(i=0; i<n; i++) { a=0; b=0; c=arr[a][b]; for(j=0; j<n; j++) { ...
176
Project_CodeNet
2,018
#include<stdio.h> int main(){ int n,i,j,d[2][100010]={}; scanf("%d",&n); for(i=0;i<2;i++){ for(j=0;j<n;j++)scanf("%d",&d[i][j]); } for(i=1;i<n;i++)d[0][ i ]+=d[0][i-1]; for(i=1;i<n;i++)d[1][n-i-1]+=d[1][n-i]; //for(i=0;i<n;i++)printf("%2d %2d\n",d[0][i],d[1][i]); for(i=j=0;i<n;i++){ if(j<d[0][...
193
Project_CodeNet
2,019
#include<stdio.h> int main() { int N,x,i,j,k,A[100][100],temp,half1[100],half2[100],sum[100]; scanf("%d",&N); for(x=0;x<N;x++) scanf("%d",&A[x][0]); for(x=0;x<N;x++) scanf("%d",&A[x][1]); for(i=0;i<N;i++) { for(k=0;k<i+1;k++) { half1[i]=half1[i]+A[k][0]; ...
237
Project_CodeNet
2,019
#include<stdio.h> int main() { int N; scanf("%d", &N); int **A = (int **)malloc(sizeof(int*) * 2); for (int i = 0; i < 2; i++) { A[i] = (int *)malloc(sizeof(int) * N); } for (int i = 0; i < 2; i++) { for (int j = 0; j < N; j++) { scanf("%d", &A[i][j]); } } //for (int i = 0; i < 2; i++) //{ // for...
315
Project_CodeNet
2,019
#include <stdio.h> int solv(int n) { int i, a1[101], a2[101], max, res; for (i = 0; i < n; i++) { scanf("%d", a1 + i); } for (i = 0; i < n; i++) { scanf("%d", a2 + i); } for (i = 1; i < n; i++) { a1[i] += a1[i - 1]; a2[n - i - 1] += a2[n - i]; } res = 0; max = 0; for (i = 0; i < ...
245
Project_CodeNet
2,018
/* cat <<EOF >mistaken-paste */ #pragma GCC diagnostic ignored "-Wincompatible-pointer-types" #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> #define BIG 2000000007 #define VERYBIG 200000000000007LL #define MOD 1000000007 typedef uint64_t ull; ty...
4,466
Project_CodeNet
2,018
#pragma warning(disable:4996) #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #define MAX_STRING 500 int main() { char sInput[MAX_STRING+1]=""; char* psInput; int i=0; int nA=0; int nB=0; int nC=0; int nHands=0; int nMax=0; int nColumns=0; int nUpPoints[101]; int nDownPoints[...
350
Project_CodeNet
2,020
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define MOD1 1000000007 #define MOD2 998244353 #define LIMIT1 200002 #define LIMIT2 500002 typedef long long ll; typedef long double ld; typedef const void cv; #define rep(i,n) for((i)=0;(i)<(n);(i)++) #define per(i,n) for((i)=(n)-1;(i)>=0;(i)...
762
Project_CodeNet
2,018
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(void){ int n, a[2][100], i, j, d=0, maxd=0, max=0, ans=0; scanf("%d",&n); for(i=0;i<2;i++) for(j=0;j<n;j++) scanf("%d",&a[i][j]); for(i=0;i<n-1;i++){ d+=a[1][n-2-i]-a[0][n-1-i]; if(maxd<d){max=i; maxd=d;} } max = ...
219
Project_CodeNet
2,018
#include<stdio.h> int main() { int n, i, a[2][100]={0}, lsum=0, rsum=0, max=0; scanf("%d", &n); for(i = 0; i < n; i++){ scanf("%d", &a[0][i]); } for(i = 0; i < n; i++){ scanf("%d", &a[1][i]); rsum += a[1][i]; } for(i = 0; i < n; i++){ lsum += a[0][i]; if((lsum + rsum) > max){ max = lsum + rsum; } rsum -= a[1][i]; } pri...
162
Project_CodeNet
2,018
#include <stdio.h> #include <stdlib.h> int main() { int n,i,j,a[2][101],p=0,m=0,max,sum; scanf("%d",&n); for(i=0;i<2;i++) for(j=0;j<n;j++) { scanf("%d",&a[i][j]); } max=0; for(j=0;j<n;j++) { max=max+a[1][j]; } max=max+a[0][0]; while(p<n) { sum...
202
Project_CodeNet
2,019
#include<stdio.h> int main() { int n; scanf("%d", &n); int i, j; int a[2][102]; for (i = 0; i < 2; i++) for (j = 0; j < n; j++) scanf("%d", &a[i][j]); int ans = 0, x; for (i = 0; i < n; i++) { x = 0; for (j = 0; j <= i; j++) x += a[0][j]; for (j = i; j < n; j++) x += a[1][j]; if (ans < x) ...
169
Project_CodeNet
2,020
#include<stdio.h> int main(void){ int n; scanf("%d",&n); int a[2][n]; for(int i = 0;i < 2;i ++){ for(int j = 0;j < n;j ++){ scanf("%d",&a[i][j]); } } int ans = 0 , max = 0; for(int i = 0;i < n;i ++){ int t = 0; for(int j = 0;j < n;j ++){ ans += a[t][j]; if(i == j){ ...
178
Project_CodeNet
2,018
#include <stdio.h> int main(void) { int n; scanf("%d",&n); int a[103]={}; int b[103]={}; int tt[103]={0}; for(int p=0;p<n;p++) { scanf("%d ",&a[p]); for(int r=p;r<n;r++)tt[r]+=a[p]; } for(int q=0;q<n;q++) { scanf("%d ",&b[q]); for(int s=0;s<=q;s++)...
166
Project_CodeNet
2,018
#include <stdio.h> #include <stdlib.h> int n; int a[2][100]; int ans=0, ansmax=0; int main(void){ scanf("%d", &n); for(int i=0;i<n;i++) scanf("%d", &a[0][i]); for(int i=0;i<n;i++) scanf("%d", &a[1][i]); for(int i=0;i<n;i++){ ans=0; for(int j=0;j<=i;j++) ans += a[0][j]; for(int j=i;j<n;j++) ans += a[1][j]; ...
157
Project_CodeNet
2,018
//set many funcs template #include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> #include<time.h> #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int max(int a,int b){if(a>b){return a;}return b;} int min(int a,int b){if(a<b){return a...
1,506
Project_CodeNet
2,018
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char str[1000]; char *tok; int n; int a[100][2]; int i1,i3,i4; fgets(str, sizeof(str), stdin); tok=strtok(str," "); n=strtol(tok,NULL,10); //printf("%d\n",n); fgets(str, sizeof(str), stdin...
339
Project_CodeNet
2,020
/* * FileName: C * CreatedDate: 2020-04-05 14:08:04 +0900 * LastModified: 2020-04-05 14:35:31 +0900 */ #include <stdio.h> int main(void){ int N; scanf("%d",&N); int A[2][N],dp[2][N]; for(int i=0;i<2;i++){ for(int j=0;j<N;j++){ scanf("%d",&A[i][j]); } } dp[0]...
307
Project_CodeNet
2,018
#include<stdio.h> int main(void){ int n ,i ,j ,total = 0, max = 0; scanf("%d",&n); int a[2][n]; for(i = 0; i < 2;i++){ for(j = 0; j < n ;j++){ scanf("%d",&a[i][j]); } } for(i = 0; i < n; i++){ // i<=jなら二段目の計算 for(j = 0; j < n; j++){ if(i <= j){ total += a[1][j]; ...
196
Project_CodeNet
2,018
#include <stdio.h> #include <stdlib.h> int f(int *a,int *b) { int i,s=0; for(i=0;a+i!=b;i++) s+=a[i]; return s; } int main() { int n,i,m; scanf("%d",&n); int a[n],b[n]; for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) scanf("%d",&b[i]); for(i=0;i<n;i++) ...
165
Project_CodeNet
2,020
say max ($///=words)[$//2+.++..*,^$_].flat.sum xx get
21
Project_CodeNet
2,018
$N=<>; @A=map[glob],<>; $_[0][0]=$A[0][0]; $_[0][$_]=$_[0][$_-1]+$A[0][$_]for 1..$N-1; $_[1][0]=$A[0][0]+$A[1][0]; $_[1][$_]=($_[1][$_-1]>$_[0][$_]?$_[1][$_-1]:$_[0][$_])+$A[1][$_]for 1..$N-1; print$_[1][$N-1]
130
Project_CodeNet
2,018
$N =int(<STDIN>); @A1=split(" ",<STDIN>); @A2=split(" ",<STDIN>); $x=$N-1; $B2=$A2[$x]; $B1=$B2+$A1[$x]; for($x=$N-2;$x>=0;$x--){ $B2=$A2[$x]+$B2; $B1=($B2>$B1)?$B2+$A1[$x]:$B1+$A1[$x]; } print $B1;
120
Project_CodeNet
2,018
import core.bitop; import std.algorithm; import std.ascii; import std.bigint; import std.conv; import std.functional; import std.math; import std.numeric; import std.range; import std.stdio; import std.string; import std.random; T lread(T = long)() { return readln.chomp.to!T(); } T[] aryread(T = long)() { ret...
255
Project_CodeNet
2,019
unittest { assert( [ "5", "3 2 2 4 1", "1 2 2 2 1" ].parse.expand.solve == 14 ); assert( [ "4", "1 1 1 1", "1 1 1 1" ].parse.expand.solve == 5 ); assert( [ "7", "3 3 4 5 4 5 3", "5 3 4 4 2 3 2" ].parse.expand.solve == 29 ); assert( [ "1", "2", "3" ].parse.expand.solve == 5 ); } import std.algorithm; import std.c...
364
Project_CodeNet
2,018
import std.algorithm; import std.array; import std.ascii; import std.bigint; import std.complex; import std.container; import std.conv; import std.functional; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; auto readInts() { return array(map!(to!int)(readln().strip().split...
1,769
Project_CodeNet
2,018
import std.stdio; import std.string; import std.format; import std.conv; import std.typecons; import std.algorithm; import std.functional; import std.bigint; import std.numeric; import std.array; import std.math; import std.range; import std.container; import std.ascii; import std.concurrency; import std.traits; import...
1,605
Project_CodeNet
2,018
import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, std.bitmanip; const long MOD = 10^^9 + 7; void main() { auto N = readln.chomp.to!int; auto A = 2.iota.map!(_ => readln.split.map!(t...
216
Project_CodeNet
2,018
import std.stdio, std.string, std.conv; import std.range, std.algorithm, std.array; import std.typecons : Tuple; void main() { int n; scan(n); auto a = readln.split.to!(int[]); auto b = readln.split.to!(int[]); int ue = a[0], sita = b.sum(); int ans = ue + sita; foreach (i ; 1 .. n) { ...
270