S JavaScriptem funguje tato webová stránka lépe.
Domů
Procházet
lain.church
Nápověda
Registrovat se
Přihlásit se
cerealxp
/
sum
Sledovat
1
Oblíbit
0
Rozštěpit
0
Zdrojový kód
Úkoly
0
Požadavky na natažení
0
Vydání
0
Wiki
Aktivita
Procházet zdrojové kódy
initial
master
Papaito
před 1 rokem
revize
9f295fafdd
6 změnil soubory
, kde provedl
30 přidání
a
0 odebrání
Rozdělené zobrazení
Diff Options
Zobrazit statistiky
Download Patch File
Stáhněte rozdílový soubor
+1
-0
.gitignore
+7
-0
Cargo.lock
+8
-0
Cargo.toml
+0
-0
cargo
+0
-0
main.rs
+14
-0
src/main.rs
+ 1
- 0
.gitignore
Zobrazit soubor
@@ -0,0 +1 @@
/target
+ 7
- 0
Cargo.lock
Zobrazit soubor
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "sum"
version = "0.1.0"
+ 8
- 0
Cargo.toml
Zobrazit soubor
@@ -0,0 +1,8 @@
[package]
name = "sum"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+ 0
- 0
cargo
Zobrazit soubor
+ 0
- 0
main.rs
Zobrazit soubor
+ 14
- 0
src/main.rs
Zobrazit soubor
@@ -0,0 +1,14 @@
use std::io::{self, BufRead};
fn main() {
let stdin = io::stdin();
let sum: u32 = stdin
.lock()
.lines()
.map(|line| -> u32 {
let num: u32 = line.unwrap().parse().unwrap_or(0);
num
}).sum();
println!("{}", sum);
}
Zapsat
Náhled
Načítá se…
Zrušit
Uložit