結果
| 問題 |
No.78 クジ付きアイスバー
|
| コンテスト | |
| ユーザー |
holeguma
|
| 提出日時 | 2015-08-14 12:11:36 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 661 bytes |
| コンパイル時間 | 2,147 ms |
| コンパイル使用メモリ | 74,892 KB |
| 実行使用メモリ | 52,692 KB |
| 最終ジャッジ日時 | 2024-10-06 17:41:47 |
| 合計ジャッジ時間 | 4,814 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 RE * 3 |
| other | AC * 1 WA * 4 RE * 30 |
ソースコード
import java.io.*;
import java.util.StringTokenizer;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
StringTokenizer st= new StringTokenizer(line);
int n=Integer.parseInt(st.nextToken());
int k=Integer.parseInt(st.nextToken());
int ans=0;
int[] ice=new int[n];
line=br.readLine();
for(int i=0;i<n;i++) ice[i]=line.charAt(i)-'0';
int eat=0;
while(true){
ans++;
eat+=1+ice[ans%n-1];
if(eat>=k) break;
}
out.println(ans);
out.flush();
}
}
}
holeguma