對數x,擦除某些位,形成6的倍數

2021-07-30 08:57:10 字數 521 閱讀 7669

題目大意:給你乙個字串,要求讓你刪除最少個數的元素,使得最終數字是沒有前導0並且是6的倍數。輸出最多的字元個數,無解輸』-1s』

codeforces 792c,是形成3的倍數,輸出字串

是個dp很好理解,但前導零的處理很奇怪,就當模板存了

#include 

#include

#include

#include

using

namespace

std;

const

int maxn=1e5+10,inf=1e9+10;

int n,ans,f[maxn][10];

char s[maxn];

int main()

if (ans>0) printf("%d\n",ans); else

printf("-1s\n");

}return

0;}