<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>sugarknri</author_name>
  <author_url>https://blog.hatena.ne.jp/sugarknri/</author_url>
  <blog_title>メモ</blog_title>
  <blog_url>https://sugarknri.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>問題はこちら No.78 クジ付きアイスバー - yukicoder制約が大きいので愚直にシミュレーションすると通らない……はずなのだけど、Cは速いからギリギリ通っちゃうんだなこれが char box[60]; int n,k,cost,stock,p; int main(){ scanf(&quot;%d%d%s&quot;,&amp;n,&amp;k,box); while(k--){ if(stock&gt;0)stock--;else cost++; stock+=box[p]-'0'; p++; if(p==n)p=0; } printf(&quot;%d&quot;,cost); return 0; } stockは高々k+1にしかならないの…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsugarknri.hatenablog.com%2Fentry%2F2016%2F10%2F30%2F035054&quot; title=&quot;yukicoder No.78 クジ付きアイスバー - メモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2016-10-30 03:50:54</published>
  <title>yukicoder No.78 クジ付きアイスバー</title>
  <type>rich</type>
  <url>https://sugarknri.hatenablog.com/entry/2016/10/30/035054</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
