東大卒のお金やりくり奮闘記~株、家計、趣味、経済~

東大卒でメーカー勤務の私がセミリタイアするために投資などを頑張っていこうという趣旨で始めたブログです。既婚男性です。株、家計、趣味、経済の話をメインにゆるゆる話します。

ABC189で書いたコード

using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace debug
{
    class main
    {
        static void Main(string args)
        {
            //問題クラスを展開
            ProgramD a = new ProgramD();
            a.main();//実行する

        }

    }
    //ABC189
    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();

            //s[0] == s[1] かつs[1] == s[2]なら勝ち
            if (s[0] == s[1] && s[1] == s[2])
                Console.WriteLine("Won");
            else
                Console.WriteLine("Lost");

           

        }
    }

    class ProgramB
    {
        public void main()
        {
            //入
            string s = Console.ReadLine().Split();
            long n = long.Parse(s[0]);
            long x = long.Parse(s[1]) * 100;//あらかじめ100倍しておく
            

            long ans = 0;
            //毎回比較
            for (int i = 0i < ni++)
            {
                string b = Console.ReadLine().Split();
                ans += long.Parse(b[0]) * long.Parse(b[1]);
                //もし許容量超えたらi+1杯目が答え
                if (ans > x)
                {
                    Console.WriteLine(i + 1);
                    return;
                }

            }

            //もし許容量超えなかったら-1を出力。
            Console.WriteLine(-1);



        }
    }

    class ProgramC
    {
        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine().Split();
            long[] a = new long[n];

            for (int i = 0i < ni++)
                a[i] = long.Parse(s[i]);

            long ans = 0;
            //Lを固定してRを更新。そのたびに最小を比較しておく
            for (int i = 0i < ni++)
            {
                long x = a[i];
                for(int j = i;j < n;j++)
                {
                    x = Math.Min(xa[j]);
                    ans = Math.Max(ansx * (j - i + 1));//最小×(R-L+1)で比較
                }
            }


            Console.WriteLine(ans);
        }



    }


    class ProgramD
    {

        public void main()
        {

            //入力
            int n = int.Parse(Console.ReadLine());

            //初項はTrueになるのは一通り
            long dp = 1;
            //もしORなら2のi+1乗を足す。
            for (int i = 0i < ni++)
            {
                string s = Console.ReadLine();
                if (s == "OR")
                    dp = dp + (long)Math.Pow(2i + 1);
                    
            }
            
            //出力
            Console.WriteLine(dp);

        }
    }


    

}