結果

問題 No.1292 パタパタ三角形
ユーザー 沙耶花沙耶花
提出日時 2020-05-02 15:28:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 208,692 KB
実行使用メモリ 19,104 KB
最終ジャッジ日時 2023-09-18 01:30:15
合計ジャッジ時間 3,919 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 72 ms
19,104 KB
testcase_13 AC 71 ms
18,984 KB
testcase_14 AC 10 ms
4,376 KB
testcase_15 AC 11 ms
4,376 KB
testcase_16 AC 11 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:35:25: 警告: ‘ind’ may be used uninitialized [-Wmaybe-uninitialized]
   35 |                         if(ind==1)x+=L,y-=0.5;
      |                         ^~
main.cpp:24:21: 備考: ‘ind’ はここで定義されています
   24 |                 int ind;
      |                     ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	vector<string> T = {"abc","cab","bca"};
	
	string S;
	cin>>S;

	set<pair<long double,long double>> A;
	
	long double x=0.0,y=0.0;
	A.insert({x,y});
	
	int now = 0;
	long double L = sqrt((long double)3.0)/2.0;
	for(int i=0;i<S.size();i++){
		int ind;
		for(int j=0;j<3;j++){
			if(T[now][j]==S[i]){
				ind = j;
				break;
			}
		}
		
		now = (now+ind)%3;
		if(i%2==0){
			if(ind==0)x-=L,y-=0.5;
			if(ind==1)x+=L,y-=0.5;
			if(ind==2)y+=1.0;
		}
		else{
			if(ind==0)x+=L,y+=0.5;
			if(ind==1)y-=1.0;
			if(ind==2)x-=L,y+=0.5;
		}
		A.insert({x,y});
	}
	
	cout<<A.size()<<endl;
	
	
	return 0;
}
0