結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2016-12-25 09:19:29 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 801 bytes |
コンパイル時間 | 840 ms |
コンパイル使用メモリ | 104,448 KB |
実行使用メモリ | 21,888 KB |
最終ジャッジ日時 | 2024-10-13 08:49:53 |
合計ジャッジ時間 | 1,718 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static int N = int.Parse(Console.ReadLine()); static void Main() { for (int i = 0; i < N; i++) { string S = Console.ReadLine(); Console.WriteLine(Hantei(S)); } } static string Hantei(string s) { int gcnt = 0; int rcnt = 0; for (int i = 0; i < s.Length; i++) { if (s[i] == 'G') gcnt++; if (s[i] == 'R') rcnt++; if (rcnt > gcnt) return "impossible"; } if (gcnt != rcnt||gcnt==0) return "impossible"; else return "possible"; } }