結果

問題 No.457 (^^*)
ユーザー butter_rollbutter_roll
提出日時 2016-12-14 00:43:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 896 bytes
コンパイル時間 751 ms
コンパイル使用メモリ 70,032 KB
実行使用メモリ 11,436 KB
最終ジャッジ日時 2023-08-20 02:36:56
合計ジャッジ時間 4,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,612 KB
testcase_01 AC 2 ms
4,508 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 11 ms
4,380 KB
testcase_10 AC 55 ms
4,384 KB
testcase_11 AC 222 ms
4,384 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main(void){

  int l1,l2,l3,l4,l5;//(^^*)
  int r1,r2,r3,r4,r5;//(*^^)
  string s;
  int resl,resr;
  resl=resr=0;
  cin>>s;

  l1=l2=l3=l4=l5=0;
  r1=r2=r3=r4=r5=0;

  for(l1=s.find("(",0);l1!=-1;l1=s.find("(",l1+1)){
    for(l5=s.find(")",l1+1);l5!=-1;l5=s.find(")",l5+1)){
      //printf("%d %d : ",l1,l5);
      l2=s.find("^",l1+1); 
      l3=s.find("^",l2+1); 
      l4=s.find("*",l3+1);
      //printf("%d %d %d\n",l2,l3,l4);
      if(l2!=-1&&l3!=-1&&l4!=-1&&l4<l5) resl++;
    }
  }

  for(l1=s.find("(",0);l1!=-1;l1=s.find("(",l1+1)){
    for(l5=s.find(")",l1+1);l5!=-1;l5=s.find(")",l5+1)){
      l2=s.find("*",l1+1); 
      l3=s.find("^",l2+1); 
      l4=s.find("^",l3+1);
      if(l2!=-1&&l3!=-1&&l4!=-1&&l4<l5) resr++;
    }
  }

      
  cout<<resl<<" "<<resr<<endl;
  return 0;
}
0