【NOIP2018模擬賽19.8.23】capacitor

題目 分析 根據兩個方案,倒着推導,由於每一步必定是原來的值,再與一個容量爲1的操做,因此由a/b能夠獲得:ios a>b,則上一步爲(a-b)/b,即a/b一直減1,能夠直接作除法,避免TLE a<b,則上一步a/(b-a),即b一直減a,能夠相似第一種狀況去作 代碼 #include <cstdio> #include <iostream> #include <algorithm> using
相關文章
相關標籤/搜索