結果

問題 No.78 クジ付きアイスバー
ユーザー RIGIH
提出日時 2017-07-26 01:13:36
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3,116 ms / 5,000 ms
コード長 596 bytes
コンパイル時間 801 ms
コンパイル使用メモリ 65,596 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-09 17:31:44
合計ジャッジ時間 44,485 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define mass 1000000007
using namespace std;
int keta(int n,int k){return (n/int(pow(10,double(k-1)))) % 10;} //nの下からk桁目


int main(){
	
	int n,k;
	cin>>n>>k;
	char s[51];
	cin>>s;
	int a=0;
	int c=0;
	int b=0;

	rep(i,k){
		if(a==0){
			c++;
		}else{
			a--;
		}
		a+=int(s[b])-48;
		b++;
		if(b==n){
			b=0;
		}
	}
	cout<<c<<endl;

	return 0;

}

0