Guest User

Untitled

a guest
Dec 14th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int ans = -1000000000; // グローバル変数として、答えを入れる変数を用意する
  6. int a[10]; // こちらは、実際の営業フラグを入れる
  7.  
  8. // 最終的な答えを出す関数
  9. void func(void) {
  10. if( a ○○○○○○) return;
  11. int score = ;// aだった時のスコア
  12. ans = max(ans,score);
  13. }
  14.  
  15. // 総当たりのための関数
  16. void difs(int pos) {
  17. if( pos => 10 ) {
  18. // 10個以上は計算しないので、ここでおわり!
  19. func();
  20. return;
  21. } else {
  22. // ここでどんどんansを更新する
  23. a[pos] = 0; difs(pos+1);
  24. a[pos] = 1; difs(pos+1);
  25. }
  26. }
  27.  
  28. int main(void)
  29. {
  30. //
  31. // 入力を済ませる
  32. //
  33.  
  34. defs(0); // 0 からスタート
  35. cout << ans << endl;
  36. return 0;
  37. }
Add Comment
Please, Sign In to add comment