1 #include <iostream> 2 #include <vector> 3 #include <algorithm> 4 #include <iterator> 5 #define LL long long 6 7 using namespace std; 8 9 class LittleElephantAndPermutationDiv2{ 10 public: 11 LL getNumber(int N, int k){ 12 LL res = 0; 13 vector<int> a(N); 14 for(int i = 0 ; i < N; ++ i ){ 15 a[i] = i + 1; 16 } 17 do{ 18 LL value = 0; 19 for(int i = 0; i < N; ++ i){ 20 value += max(a[i],i+1); 21 } 22 if( value >= k ) ++res; 23 copy(a.begin(),a.end(),ostream_iterator<int>(cout," ")); 24 cout<<endl; 25 }while(next_permutation(a.begin(),a.end())); 26 cout<<res<<endl; 27 for(int i = 1; i<= N; ++ i) res *= i; 28 return res; 29 } 30 };
topcoder SRM 592 DIV2 LittleElephantAndPermutationDiv2
相關文章
- topcoder SRM 592 DIV2 LittleElephantAndBooks
- topcoder SRM 593 DIV2 RaiseThisBarnAI
- topcoder SRM 593 DIV2 WolfDelaymasterAST
- topcoder SRM 591 DIV2 TheArithmeticProgression
- topcoder SRM 628 DIV2 BishopMove
- topcoder SRM 628 DIV2 BracketExpressionsRacketExpress
- topcoder SRM 610 DIV2 TheMatrix
- Topcoder SRM 626 DIV2 SumOfPower
- topcoder SRM 624 DIV2 CostOfDancing
- topcoder SRM 625 DIV2 AddMultiply
- topcoder SRM 625 DIV2 IncrementingSequenceREMGse
- topcoder SRM 623 DIV2 CatAndRat
- topcoder SRM 594 DIV2 AstronomicalRecordsEasyAST
- topcoder SRM 610 DIV2 DivideByZeroIDE
- topcoder SRM 624 DIV2 BuildingHeightsEasyUI
- topcoder SRM 618 DIV2 WritingWords
- topcoder SRM 623 DIV2 CatchTheBeatEasy
- Topcoder SRM646 DIV2 1000
- Topcoder SRM 626 DIV2 FixedDiceGameDiv2GAM
- topcoder SRM 617 DIV2 SlimeXSlimonadeTycoon
- topcoder SRM 618 DIV2 LongWordsDiv2
- topcoder SRM 619 DIV2 GoodCompanyDivTwoGo
- TopCoder SRM 588 DIV2 KeyDungeonDiv2
- Topcoder SRM 583 DIV2 SwappingDigitsAPPGit
- topcoder SRM 618 DIV2 MovingRooksDiv2
- topcoder SRM 622 DIV2 BoxesDiv2
- topcoder SRM 622 DIV2 FibonacciDiv2
- topcoder 594 DIV2 foxandclassroomOOM
- BZOJ2454 : TopCoder SRM 463 RabbitPuzzle
- Topcoder SRM 638 DIV 2 (大力出奇跡)
- TopCoder SRM 639 Div.2 500 AliceGameEasyGAM
- 最安全的SRM錢包,SRM冷錢包使用教程
- Codeforces #245(div2)
- Oracle 11G OCP 1Z0-053 592Oracle
- SRM系統是什麼系統?如何應用SRM系統?
- codeforces #197(div2)
- codeforces #198(div2)
- Codeforces Round #470 div2 C