이 웹사이트는 자바스크립트 활성화가 필요합니다.
홈
탐색
lain.church
도움말
가입하기
로그인
cerealxp
/
sum
보기
1
좋아요
0
포크
0
코드
이슈
0
풀 리퀘스트
0
릴리즈
0
위키
활동
소스 검색
initial
master
Papaito
1 년 전
커밋
9f295fafdd
6개의 변경된 파일
과
30개의 추가작업
그리고
0개의 파일을 삭제
분할 보기
Diff Options
Show Stats
Download Patch File
Download Diff File
+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
파일 보기
@@ -0,0 +1 @@
/target
+ 7
- 0
Cargo.lock
파일 보기
@@ -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
파일 보기
@@ -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
파일 보기
+ 0
- 0
main.rs
파일 보기
+ 14
- 0
src/main.rs
파일 보기
@@ -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);
}
쓰기
미리보기
불러오는 중...
취소
저장