結果
問題 | No.502 階乗を計算するだけ |
ユーザー | akakimidori |
提出日時 | 2017-04-13 17:54:36 |
言語 | C90 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 6 ms / 1,000 ms |
コード長 | 5,485 bytes |
コンパイル時間 | 105 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 12:56:24 |
合計ジャッジ時間 | 1,275 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 0 ms
5,376 KB |
testcase_02 | AC | 0 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 0 ms
5,376 KB |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 0 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 0 ms
5,376 KB |
testcase_10 | AC | 0 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 0 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 1 ms
5,376 KB |
testcase_15 | AC | 1 ms
5,376 KB |
testcase_16 | AC | 0 ms
5,376 KB |
testcase_17 | AC | 0 ms
5,376 KB |
testcase_18 | AC | 0 ms
5,376 KB |
testcase_19 | AC | 0 ms
5,376 KB |
testcase_20 | AC | 0 ms
5,376 KB |
testcase_21 | AC | 0 ms
5,376 KB |
testcase_22 | AC | 6 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 4 ms
5,376 KB |
testcase_25 | AC | 1 ms
5,376 KB |
testcase_26 | AC | 2 ms
5,376 KB |
testcase_27 | AC | 1 ms
5,376 KB |
testcase_28 | AC | 2 ms
5,376 KB |
testcase_29 | AC | 1 ms
5,376 KB |
testcase_30 | AC | 5 ms
5,376 KB |
testcase_31 | AC | 3 ms
5,376 KB |
testcase_32 | AC | 2 ms
5,376 KB |
testcase_33 | AC | 4 ms
5,376 KB |
testcase_34 | AC | 3 ms
5,376 KB |
testcase_35 | AC | 3 ms
5,376 KB |
testcase_36 | AC | 3 ms
5,376 KB |
testcase_37 | AC | 3 ms
5,376 KB |
testcase_38 | AC | 3 ms
5,376 KB |
testcase_39 | AC | 1 ms
5,376 KB |
testcase_40 | AC | 5 ms
5,376 KB |
testcase_41 | AC | 1 ms
5,376 KB |
testcase_42 | AC | 1 ms
5,376 KB |
testcase_43 | AC | 1 ms
5,376 KB |
testcase_44 | AC | 1 ms
5,376 KB |
testcase_45 | AC | 1 ms
5,376 KB |
testcase_46 | AC | 0 ms
5,376 KB |
testcase_47 | AC | 1 ms
5,376 KB |
testcase_48 | AC | 1 ms
5,376 KB |
testcase_49 | AC | 0 ms
5,376 KB |
testcase_50 | AC | 1 ms
5,376 KB |
testcase_51 | AC | 0 ms
5,376 KB |
コンパイルメッセージ
main.c: In function ‘run’: main.c:24:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%lld",&n); | ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> const int m=1000000007; const int step=2011893; void pre(void){ long long int f=1; int i; for(i=1;i<m;i++){ if((i-1)%step==0){ printf("%lld,",f); } f=f*i%m; } printf("\n"); } int f[]={1,85034334,628431548,233437618,23357604,217184401,268937872,528997029,836879579,392239252,651133530,5323000,227992106,342568881,956063824,948989837,197134944,885164680,551868730,38188198,970645443,34882334,752435983,833344511,994492963,462862624,370714686,306900584,478716887,795726016,465426484,960766808,853976429,445376934,618858283,432867712,334814123,913429048,719928012,106258537,945851249,439191546,592822258,876831484,191611905,154452015,934433005,529067374,258606845,207326424,968523659,227490120,898198089,947073794,266900042,782773875,419604605,12132545,369668511,161181724,695581712,764080780,826954569,518831628,267115833,52289644,711812790,967709706,153285439,889684396,371584300,136406220,704135484,167144402,698718610,939676453,69814720,758411196,187282912,457762989,223943909,798031278,873614289,459686539,422458729,171714861,583619188,992164257,924726977,330958787,404168400,320030151,297324108,60135140,832474193,728937208,986143552,697170394,165344141,809977922,393371457,146181879,733787351,605969051,808173111,43016135,839503396,894620057,969605672,658334084,897478814,488379200,262073886,105639396,462485599,680319745,962877659,306772225,944586482,529939876,555072316,961322817,998379723,76458088,193115856,267700699,849096846,628211845,715569053,574372332,79550570,557537346,403819837,732992938,870270917,24637772,683323722,633943757,713922557,917160453,590590725,333518391,938461098,998468767,643883457,159052662,754536158,939691734,322368982,738587487,729013658,881428600,719628561,256022859,117347328,171259026,756427112,97717551,146452528,638098729,263928557,367425737,685205378,178831570,419180920,676222789,526778849,312131170,22237654,703435553,455441945,734049965,289586617,240591762,222973489,471479846,597663843,65347344,343681554,157696321,195788472,456793017,590474166,34135643,800129624,472325608,634406383,692092098,733345975,364650393,655394336,254087392,735775934,427882337,241686987,900104720,922944158,23123532,669774988,95887608,988625368,407783507,822425556,259745273,96896066,732802242,364028175,276388779,507965230,733948853,569660104,432953353,390943025,52746366,408538946,72996894,627409129,412973469,25700813,551592798,421467174,260496975,293562754,978981702,315480723,611476239,130766454,178137486,667140528,214040806,600481058,838977586,374981257,843901155,722604720,574091367,182648070,815083914,502684084,755744365,502830224,495207538,387853678,55356209,55766310,291758471,131103778,960459482,735293545,236672377,591387189,210634265,937014550,575628788,18218581,967665193,55175346,820700103,548954855,143065987,1339437,329339179,270637515,31863438,979256317,3125665,643964261,256849873,674222203,710392044,33491684,654701047,736880803,491580271,951983770,693351721,324332543,219420344,615137223,370868126,283683418,268559167,894961803,761580980,209378287,449353500,297545050,836756483,818730824,30751412,38207460,429481875,726531247,540010600,770091522,988974440,556158267,873621654,448097420,635015837,175152810,647361212,240281583,633284308,570678962,161062130,720793799,825477104,423825848,659258762,366606877,373451870,762162069,510672771,31697062,293488554,380806925,962171405,404371959,349941926,427497351,962216406,981653941,168208223,66573481,81673852,184775458,908504363,15433448,537301293,528866148,932450374,882603481,843083167,853796519,814754558,330060177,906106212,651859193,682594484,848200181,470709023,959521318,364285032,69511896,884719358,987285733,214365088,10491744,898521922,613970546,296964416,155733482,784484273,379704842,893976940,977875540,617681214,860289490,167924431,211205722,450392554,894726542,702239591,564886201,662208297,961864330,748678702,587862082,962056283,662269226,965521153,585499637,62904578,360323117,849352075,839614506,535606984,306232580,156981512,722385735,417085739,307098733,429291039,27939541,473735678,114874355,696414148,550735236,815600658,890707815,997393201,491913150,926905553,942127684,459894844,409809729,287319397,544034148,713540795,569205834,230395084,53636801,803403502,708341766,329098232,741502796,460675825,937376381,216259018,354474416,917646646,950824110,857860558,386639280,968509184,589371661,926571617,202818305,946662979,88718078,772739366,643008832,836968800,834758492,830431692,384741342,284077928,603950507,9790174,681602577,386515924,110189563,592437917,276249608,243463009,301559167,508223358,288450997,254637910,375368833,595560004,755091010,613745724,874280230,995382077,154340491,114321340,879732324,551348958,26058463,775379770,18446450,95657899,938299519,28006565,629544007,258836076,727879056,144510492,281535881,799099890,812629921,781879827,522232272,975957542,386770675,397837707,471098344,636336950,149724648,191045433,919642555,838027656,976794897,399438985,731574215,559265836,601453984,326464168,660708886,958347806,893417444,508047396,819727313,858884700,603492930,207620418,328402072,55532834,840882791,741543475,77638403,380216354,887218760,205139466,329413279,49289456}; void run(void){ long long int n; const int m=1000000007; scanf("%lld",&n); if(n>=m){ printf("0\n"); return; } long long int ans=f[n/step]; int i; for(i=(n/step)*step+1;i<=n;i++){ ans=ans*i%m; } printf("%lld\n",ans); return; } int main(void){ //pre(); run(); return 0; }