結果
問題 | No.570 3人兄弟(その1) |
ユーザー |
![]() |
提出日時 | 2018-03-24 17:58:08 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,599 bytes |
コンパイル時間 | 15,219 ms |
コンパイル使用メモリ | 230,832 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 03:11:23 |
合計ジャッジ時間 | 15,866 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 |
ソースコード
package mainimport ("bufio""fmt""os""strconv""strings")type Scanner struct {reader *bufio.Readerbuffer []stringpointer int}func NewScanner() *Scanner {return &Scanner{reader: bufio.NewReaderSize(os.Stdin, 4096),pointer: 0,}}func (self *Scanner) NextLine() string {var buffer []bytefor {line, isPrefix, _ := self.reader.ReadLine()buffer = append(buffer, line...)if !isPrefix {break}}return string(buffer)}func (self *Scanner) Next() string {if self.pointer >= len(self.buffer) {line := self.NextLine()self.buffer = strings.Fields(line)self.pointer = 0}self.pointer++return self.buffer[self.pointer-1]}func (self *Scanner) NextInt() int {s := self.Next()i, _ := strconv.ParseInt(s, 10, 32)return int(i)}func (self *Scanner) NextLong() int64 {s := self.Next()l, _ := strconv.ParseInt(s, 10, 64)return int64(l)}func (self *Scanner) NextFloat() float32 {s := self.Next()f, _ := strconv.ParseFloat(s, 32)return float32(f)}func (self *Scanner) NextDouble() float64 {s := self.Next()d, _ := strconv.ParseFloat(s, 64)return float64(d)}func SwapInt(x, y *int) {tmp := *x*x = *y*y = tmp}func SwapStr(x, y *string) {tmp := *x*x = *y*y = tmp}func main() {cin := NewScanner()A := cin.NextInt()B := cin.NextInt()C := cin.NextInt()a, b, c := "A", "B", "C"if A < B {SwapInt(&A, &B)SwapStr(&a, &b)}if B < C {SwapInt(&B, &C)SwapStr(&b, &c)}if A < B {SwapInt(&A, &B)SwapStr(&a, &b)}fmt.Println(a)fmt.Println(b)fmt.Println(c)}