6 条题解

  • 1
    @ 2025-11-21 23:49:48
    #include <stdio.h>
    #define int long long
    int ksm(int a) {
    	int b = 2;
    	int ans = 1;
    	while (a > 0) {
    		if (a % 2 == 1) {
    			ans = (b * ans) % 1000000; 
    		}       
    		b = (b * b) % 1000000;       
    		a /= 2;       
    	}
    	ans = (ans - 1 + 1000000) % 1000000;
    	return ans;
    }
    signed main() {
    	int t;
    	scanf("%lld", &t);
    	while (t--) {
    		int m;
    		scanf("%lld", &m);
    		int num = ksm(m);
    		printf("%lld\n", num);
    	}
    	return 0;
    }
    

    信息

    ID
    156
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    (无)
    递交数
    656
    已通过
    198
    上传者