

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #include <iostream> #include <string> #include <vector> #include <cstring> #include <cstdio> using namespace std; char ve[10004][260]; int main() { int n; cin>>n; for(int i=0;i<n;i++) { scanf("%s",&ve[i]); } int jg=strlen(ve[0]); for(int k=1;k<n;k++) { int js=0; int il=strlen(ve[k]); int jl=strlen(ve[k-1]); for(int i=0,j=0;i<il&& j<jl;i++,j++) { if(ve[k][i]==ve[k-1][j]) { js++; }else { break; } } jg=jg+1+strlen(ve[k])-js;//用一个字符表示数字 } printf("%d\n",jg); return 0; } |