Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a7faea6

Browse files
committed
ABC169-A, B, C
1 parent 1aa2ecc commit a7faea6

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed

‎abc/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,18 @@
394394
* [x] E - Sum of gcd of Tuples (Hard)
395395
* [x] F - Select Half
396396

397+
## AtCoder Beginner Contest 169
398+
399+
<https://atcoder.jp/contests/abc169>
400+
401+
* [x] A - Multiplication 1
402+
* [x] B - Multiplication 2
403+
* [x] C - Multiplication 3
404+
* 解説記事:[浮動小数点数オタクが AtCoder Beginner Contest 169 のC問題をガチで解説してみる](https://qiita.com/mod_poppo/items/910b5fb9303baf864bf7)
405+
* [ ] D - Div Game
406+
* [ ] E - Count Median
407+
* [ ] F - Knapsack for All Subsets
408+
397409
## AtCoder Beginner Contest 170
398410

399411
<https://atcoder.jp/contests/abc170>

‎abc/abc169-a/Main.hs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- https://github.com/minoki/my-atcoder-solutions
2+
import Data.Char (isSpace)
3+
import Data.List (unfoldr)
4+
import qualified Data.ByteString.Char8 as BS
5+
6+
main = do
7+
[a,b] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
8+
print $ a * b

‎abc/abc169-b/Main.hs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- https://github.com/minoki/my-atcoder-solutions
2+
{-# LANGUAGE TypeApplications #-}
3+
import Data.Char (isSpace)
4+
import Data.Int (Int64)
5+
import Data.List (unfoldr)
6+
import qualified Data.ByteString.Char8 as BS
7+
8+
main = do
9+
n <- readLn @Int
10+
xs <- unfoldr (BS.readInteger . BS.dropWhile isSpace) <$> BS.getLine
11+
let p = product xs
12+
let result | p > 10^18 = -1
13+
| otherwise = p
14+
print result

‎abc/abc169-c/Dec.hs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE TypeApplications #-}
2+
import Data.Fixed
3+
4+
main = do
5+
[s,t] <- words <$> getLine
6+
let a = read @Integer s
7+
b = read @Centi t
8+
print (truncate $ fromInteger a * b :: Integer)

‎abc/abc169-c/Fixed.hs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- https://github.com/minoki/my-atcoder-solutions
2+
{-# LANGUAGE TypeApplications #-}
3+
import Data.Int (Int64)
4+
import qualified Data.ByteString.Char8 as BS
5+
import Data.Fixed
6+
7+
type N = Fixed E2
8+
-- type N = Double
9+
10+
main = do
11+
[a,b] <- BS.words <$> BS.getLine
12+
let Just (a',_) = BS.readInteger a
13+
a'' = fromIntegral a' :: Int64
14+
b' = read @N (BS.unpack b)
15+
print $ a'' * truncate (b' * 100) `quot` 100

‎abc/abc169-c/Main.hs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- https://github.com/minoki/my-atcoder-solutions
2+
{-# LANGUAGE TypeApplications #-}
3+
import Data.Int (Int64)
4+
import qualified Data.ByteString.Char8 as BS
5+
6+
main = do
7+
[a,b] <- BS.words <$> BS.getLine
8+
let Just (a',_) = BS.readInteger a
9+
a'' = fromIntegral a' :: Int64
10+
b' = read @Double (BS.unpack b)
11+
print $ a'' * round (b' * 100) `quot` 100

‎abc/abc169-c/Rat.hs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE TypeApplications #-}
2+
import Numeric (readFloat)
3+
4+
main = do
5+
[s,t] <- words <$> getLine
6+
let a = read @Integer s
7+
[(b,"")] = readFloat @Rational t
8+
print (truncate $ fromInteger a * b :: Integer)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /