简体   繁体   English

unsigned long long int

[英]unsigned long long int

I was submitting a matrix exponentiation code in C language for finding the nth fibonacci and I was using long long int variable for storing the answer modulo 10000007 of nth fibonacci, and the judge was giving "time limit exceeded" but when I used "unsigned long long int" my code was accepted within the time and the execution time was reduced. 我用C语言提交了一个矩阵求幂代码来找到第n个斐波纳契,我使用long long int变量来存储第n个斐波那契的模块10000007,并且法官给出了“超出时间限制”但当我使用“unsigned long”时long int“我的代码在时间内被接受,执行时间减少了。

I was unable to understand why long long int was giving "time limit exceeded" and "unsigned long long int" was accepted? 我无法理解为什么long long int给出了“超出时间限制”和“unsigned long long int”被接受了? (Answers for extreme test cases were coming correct in both cases) (极端测试案例的答案在两种情况下都是正确的)

In order not to replicate anybody's effort, please see this question and this more advanced question and answers of the same topic. 为了不复制任何人的努力,请查看此问题以及同一主题的更高级的问题和答案 dthorpe 's answer in this one is highly detailed as well. dthorpe这个问题上的答案也非常详细。 wheaties ' first comment here is worth checking as a first trial. 这里的 小麦首次评论值得作为初审。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM