long long型表示范围为10^ 18,本题的10^ 30显然远超,属于 把输入的大数视为一个字符串,逐位来做除法
solution
#include #include intmain(){char m[100];int n[100];while(scanf("%s", m)!&#61;EOF){int k &#61;strlen(m), l &#61; k, num &#61;0;while(l >0){n[num &#43;&#43;]&#61;(m[k -1]-&#39;0&#39;)%2;int c &#61;0;for(int i &#61;0; i < k; i &#43;&#43;){int s &#61;((m[i]-&#39;0&#39;)&#43; c *10)/2;c &#61;(m[i]-&#39;0&#39;)%2;m[i]&#61; s &#43;&#39;0&#39;;}while(m[k - l]&#61;&#61;&#39;0&#39;)l --;}for(int i &#61; num -1; i >&#61;0; i --)printf("%d", n[i]);printf("\n");}return0; }
Irish budget airline Ryanair announced plans to significantly increase its route network from Frankfurt Airport, marking a direct challenge to Lufthansa, Germany's leading carrier. ...
[详细]