CodeForces 808A Lucky Year(思维)

来源:互联网 发布:美工设计包括哪些 编辑:程序博客网 时间:2024/06/05 04:57

题目链接:点击打开链接

思路:无敌水思维题。

// CodeForces 808A Lucky Year 运行/限制:31ms/1000ms#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <iostream>using namespace std;int main(){int num;while (scanf("%d", &num) != EOF) {int t = num;int len = (int)log10(t);//最高位后有几位for (int i = 0; i < len; i++) {t /= 10;}t++;for (int i = 0; i < len; i++) {t *= 10;}printf("%d\n", t - num);}    return 0;}