Skip to content

Commit 92839c0

Browse files
정구열정구열
authored andcommitted
문제 #2108 통계학 해결
1 parent 5c2c6ac commit 92839c0

File tree

89 files changed

+5162
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+5162
-0
lines changed

.DS_Store

2 KB
Binary file not shown.
Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 48;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
6DC21C4121845FA9002AD4D5 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6DC21C4021845FA9002AD4D5 /* main.cpp */; };
11+
/* End PBXBuildFile section */
12+
13+
/* Begin PBXCopyFilesBuildPhase section */
14+
6DC21C3B21845FA9002AD4D5 /* CopyFiles */ = {
15+
isa = PBXCopyFilesBuildPhase;
16+
buildActionMask = 2147483647;
17+
dstPath = /usr/share/man/man1/;
18+
dstSubfolderSpec = 0;
19+
files = (
20+
);
21+
runOnlyForDeploymentPostprocessing = 1;
22+
};
23+
/* End PBXCopyFilesBuildPhase section */
24+
25+
/* Begin PBXFileReference section */
26+
6DC21C3D21845FA9002AD4D5 /* BOJ_1011 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BOJ_1011; sourceTree = BUILT_PRODUCTS_DIR; };
27+
6DC21C4021845FA9002AD4D5 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
28+
/* End PBXFileReference section */
29+
30+
/* Begin PBXFrameworksBuildPhase section */
31+
6DC21C3A21845FA9002AD4D5 /* Frameworks */ = {
32+
isa = PBXFrameworksBuildPhase;
33+
buildActionMask = 2147483647;
34+
files = (
35+
);
36+
runOnlyForDeploymentPostprocessing = 0;
37+
};
38+
/* End PBXFrameworksBuildPhase section */
39+
40+
/* Begin PBXGroup section */
41+
6DC21C3421845FA9002AD4D5 = {
42+
isa = PBXGroup;
43+
children = (
44+
6DC21C3F21845FA9002AD4D5 /* BOJ_1011 */,
45+
6DC21C3E21845FA9002AD4D5 /* Products */,
46+
);
47+
sourceTree = "<group>";
48+
};
49+
6DC21C3E21845FA9002AD4D5 /* Products */ = {
50+
isa = PBXGroup;
51+
children = (
52+
6DC21C3D21845FA9002AD4D5 /* BOJ_1011 */,
53+
);
54+
name = Products;
55+
sourceTree = "<group>";
56+
};
57+
6DC21C3F21845FA9002AD4D5 /* BOJ_1011 */ = {
58+
isa = PBXGroup;
59+
children = (
60+
6DC21C4021845FA9002AD4D5 /* main.cpp */,
61+
);
62+
path = BOJ_1011;
63+
sourceTree = "<group>";
64+
};
65+
/* End PBXGroup section */
66+
67+
/* Begin PBXNativeTarget section */
68+
6DC21C3C21845FA9002AD4D5 /* BOJ_1011 */ = {
69+
isa = PBXNativeTarget;
70+
buildConfigurationList = 6DC21C4421845FA9002AD4D5 /* Build configuration list for PBXNativeTarget "BOJ_1011" */;
71+
buildPhases = (
72+
6DC21C3921845FA9002AD4D5 /* Sources */,
73+
6DC21C3A21845FA9002AD4D5 /* Frameworks */,
74+
6DC21C3B21845FA9002AD4D5 /* CopyFiles */,
75+
);
76+
buildRules = (
77+
);
78+
dependencies = (
79+
);
80+
name = BOJ_1011;
81+
productName = BOJ_1011;
82+
productReference = 6DC21C3D21845FA9002AD4D5 /* BOJ_1011 */;
83+
productType = "com.apple.product-type.tool";
84+
};
85+
/* End PBXNativeTarget section */
86+
87+
/* Begin PBXProject section */
88+
6DC21C3521845FA9002AD4D5 /* Project object */ = {
89+
isa = PBXProject;
90+
attributes = {
91+
LastUpgradeCheck = 0900;
92+
ORGANIZATIONNAME = guyeol_jeong;
93+
TargetAttributes = {
94+
6DC21C3C21845FA9002AD4D5 = {
95+
CreatedOnToolsVersion = 9.0;
96+
ProvisioningStyle = Automatic;
97+
};
98+
};
99+
};
100+
buildConfigurationList = 6DC21C3821845FA9002AD4D5 /* Build configuration list for PBXProject "BOJ_1011" */;
101+
compatibilityVersion = "Xcode 8.0";
102+
developmentRegion = en;
103+
hasScannedForEncodings = 0;
104+
knownRegions = (
105+
en,
106+
);
107+
mainGroup = 6DC21C3421845FA9002AD4D5;
108+
productRefGroup = 6DC21C3E21845FA9002AD4D5 /* Products */;
109+
projectDirPath = "";
110+
projectRoot = "";
111+
targets = (
112+
6DC21C3C21845FA9002AD4D5 /* BOJ_1011 */,
113+
);
114+
};
115+
/* End PBXProject section */
116+
117+
/* Begin PBXSourcesBuildPhase section */
118+
6DC21C3921845FA9002AD4D5 /* Sources */ = {
119+
isa = PBXSourcesBuildPhase;
120+
buildActionMask = 2147483647;
121+
files = (
122+
6DC21C4121845FA9002AD4D5 /* main.cpp in Sources */,
123+
);
124+
runOnlyForDeploymentPostprocessing = 0;
125+
};
126+
/* End PBXSourcesBuildPhase section */
127+
128+
/* Begin XCBuildConfiguration section */
129+
6DC21C4221845FA9002AD4D5 /* Debug */ = {
130+
isa = XCBuildConfiguration;
131+
buildSettings = {
132+
ALWAYS_SEARCH_USER_PATHS = NO;
133+
CLANG_ANALYZER_NONNULL = YES;
134+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
135+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
136+
CLANG_CXX_LIBRARY = "libc++";
137+
CLANG_ENABLE_MODULES = YES;
138+
CLANG_ENABLE_OBJC_ARC = YES;
139+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
140+
CLANG_WARN_BOOL_CONVERSION = YES;
141+
CLANG_WARN_COMMA = YES;
142+
CLANG_WARN_CONSTANT_CONVERSION = YES;
143+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
144+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
145+
CLANG_WARN_EMPTY_BODY = YES;
146+
CLANG_WARN_ENUM_CONVERSION = YES;
147+
CLANG_WARN_INFINITE_RECURSION = YES;
148+
CLANG_WARN_INT_CONVERSION = YES;
149+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
150+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
151+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
152+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
153+
CLANG_WARN_STRICT_PROTOTYPES = YES;
154+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
155+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
156+
CLANG_WARN_UNREACHABLE_CODE = YES;
157+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
158+
CODE_SIGN_IDENTITY = "Mac Developer";
159+
COPY_PHASE_STRIP = NO;
160+
DEBUG_INFORMATION_FORMAT = dwarf;
161+
ENABLE_STRICT_OBJC_MSGSEND = YES;
162+
ENABLE_TESTABILITY = YES;
163+
GCC_C_LANGUAGE_STANDARD = gnu11;
164+
GCC_DYNAMIC_NO_PIC = NO;
165+
GCC_NO_COMMON_BLOCKS = YES;
166+
GCC_OPTIMIZATION_LEVEL = 0;
167+
GCC_PREPROCESSOR_DEFINITIONS = (
168+
"DEBUG=1",
169+
"$(inherited)",
170+
);
171+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
172+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
173+
GCC_WARN_UNDECLARED_SELECTOR = YES;
174+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
175+
GCC_WARN_UNUSED_FUNCTION = YES;
176+
GCC_WARN_UNUSED_VARIABLE = YES;
177+
MACOSX_DEPLOYMENT_TARGET = 10.13;
178+
MTL_ENABLE_DEBUG_INFO = YES;
179+
ONLY_ACTIVE_ARCH = YES;
180+
SDKROOT = macosx;
181+
};
182+
name = Debug;
183+
};
184+
6DC21C4321845FA9002AD4D5 /* Release */ = {
185+
isa = XCBuildConfiguration;
186+
buildSettings = {
187+
ALWAYS_SEARCH_USER_PATHS = NO;
188+
CLANG_ANALYZER_NONNULL = YES;
189+
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
190+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
191+
CLANG_CXX_LIBRARY = "libc++";
192+
CLANG_ENABLE_MODULES = YES;
193+
CLANG_ENABLE_OBJC_ARC = YES;
194+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
195+
CLANG_WARN_BOOL_CONVERSION = YES;
196+
CLANG_WARN_COMMA = YES;
197+
CLANG_WARN_CONSTANT_CONVERSION = YES;
198+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
199+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
200+
CLANG_WARN_EMPTY_BODY = YES;
201+
CLANG_WARN_ENUM_CONVERSION = YES;
202+
CLANG_WARN_INFINITE_RECURSION = YES;
203+
CLANG_WARN_INT_CONVERSION = YES;
204+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
205+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
206+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
207+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
208+
CLANG_WARN_STRICT_PROTOTYPES = YES;
209+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
210+
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
211+
CLANG_WARN_UNREACHABLE_CODE = YES;
212+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
213+
CODE_SIGN_IDENTITY = "Mac Developer";
214+
COPY_PHASE_STRIP = NO;
215+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
216+
ENABLE_NS_ASSERTIONS = NO;
217+
ENABLE_STRICT_OBJC_MSGSEND = YES;
218+
GCC_C_LANGUAGE_STANDARD = gnu11;
219+
GCC_NO_COMMON_BLOCKS = YES;
220+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
221+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
222+
GCC_WARN_UNDECLARED_SELECTOR = YES;
223+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
224+
GCC_WARN_UNUSED_FUNCTION = YES;
225+
GCC_WARN_UNUSED_VARIABLE = YES;
226+
MACOSX_DEPLOYMENT_TARGET = 10.13;
227+
MTL_ENABLE_DEBUG_INFO = NO;
228+
SDKROOT = macosx;
229+
};
230+
name = Release;
231+
};
232+
6DC21C4521845FA9002AD4D5 /* Debug */ = {
233+
isa = XCBuildConfiguration;
234+
buildSettings = {
235+
CODE_SIGN_STYLE = Automatic;
236+
DEVELOPMENT_TEAM = 6N3Q3DVXRR;
237+
PRODUCT_NAME = "$(TARGET_NAME)";
238+
};
239+
name = Debug;
240+
};
241+
6DC21C4621845FA9002AD4D5 /* Release */ = {
242+
isa = XCBuildConfiguration;
243+
buildSettings = {
244+
CODE_SIGN_STYLE = Automatic;
245+
DEVELOPMENT_TEAM = 6N3Q3DVXRR;
246+
PRODUCT_NAME = "$(TARGET_NAME)";
247+
};
248+
name = Release;
249+
};
250+
/* End XCBuildConfiguration section */
251+
252+
/* Begin XCConfigurationList section */
253+
6DC21C3821845FA9002AD4D5 /* Build configuration list for PBXProject "BOJ_1011" */ = {
254+
isa = XCConfigurationList;
255+
buildConfigurations = (
256+
6DC21C4221845FA9002AD4D5 /* Debug */,
257+
6DC21C4321845FA9002AD4D5 /* Release */,
258+
);
259+
defaultConfigurationIsVisible = 0;
260+
defaultConfigurationName = Release;
261+
};
262+
6DC21C4421845FA9002AD4D5 /* Build configuration list for PBXNativeTarget "BOJ_1011" */ = {
263+
isa = XCConfigurationList;
264+
buildConfigurations = (
265+
6DC21C4521845FA9002AD4D5 /* Debug */,
266+
6DC21C4621845FA9002AD4D5 /* Release */,
267+
);
268+
defaultConfigurationIsVisible = 0;
269+
defaultConfigurationName = Release;
270+
};
271+
/* End XCConfigurationList section */
272+
};
273+
rootObject = 6DC21C3521845FA9002AD4D5 /* Project object */;
274+
}

BOJ_1011/BOJ_1011.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "2.0">
5+
</Bucket>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>BOJ_1011.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>

BOJ_1011/BOJ_1011/main.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//문제
2+
//우현이는 어린 시절, 지구 외의 다른 행성에서도 인류들이 살아갈 수 있는 미래가 오리라 믿었다. 그리고 그가 지구라는 세상에 발을 내려 놓은 지 23년이 지난 지금, 세계 최연소 ASNA 우주 비행사가 되어 새로운 세계에 발을 내려 놓는 영광의 순간을 기다리고 있다.
3+
//
4+
//그가 탑승하게 될 우주선은 Alpha Centauri라는 새로운 인류의 보금자리를 개척하기 위한 대규모 생활 유지 시스템을 탑재하고 있기 때문에, 그 크기와 질량이 엄청난 이유로 최신기술력을 총 동원하여 개발한 공간이동 장치를 탑재하였다. 하지만 이 공간이동 장치는 이동 거리를 급격하게 늘릴 경우 기계에 심각한 결함이 발생하는 단점이 있어서, 이전 작동시기에 k광년을 이동하였을 때는 k-1 , k 혹은 k+1 광년만을 다시 이동할 수 있다. 예를 들어, 이 장치를 처음 작동시킬 경우 -1 , 0 , 1 광년을 이론상 이동할 수 있으나 사실상 음수 혹은 0 거리만큼의 이동은 의미가 없으므로 1 광년을 이동할 수 있으며, 그 다음에는 0 , 1 , 2 광년을 이동할 수 있는 것이다. ( 여기서 다시 2광년을 이동한다면 다음 시기엔 1, 2, 3 광년을 이동할 수 있다. )
5+
//
6+
//
7+
//김우현은 공간이동 장치 작동시의 에너지 소모가 크다는 점을 잘 알고 있기 때문에 x지점에서 y지점을 향해 최소한의 작동 횟수로 이동하려 한다. 하지만 y지점에 도착해서도 공간 이동장치의 안전성을 위하여 y지점에 도착하기 바로 직전의 이동거리는 반드시 1광년으로 하려 한다.
8+
//
9+
//김우현을 위해 x지점부터 정확히 y지점으로 이동하는데 필요한 공간 이동 장치 작동 횟수의 최솟값을 구하는 프로그램을 작성하라.
10+
//
11+
//입력
12+
//입력의 첫 줄에는 테스트케이스의 개수 T가 주어진다. 각각의 테스트 케이스에 대해 현재 위치 x 와 목표 위치 y 가 정수로 주어지며, x는 항상 y보다 작은 값을 갖는다. ( 0 ≤ x < y < 231)
13+
//
14+
//출력
15+
//각 테스트 케이스에 대해 x지점으로부터 y지점까지 정확히 도달하는데 필요한 최소한의 공간이동 장치 작동 회수를 출력한다.
16+
17+
#include <iostream>
18+
#include <vector>
19+
using namespace std;
20+
int solution(pair<int,int> xy){
21+
int answer=0;
22+
int dist=xy.second-xy.first;
23+
int i=1;
24+
while(true){
25+
dist-=i;
26+
if(dist<=0){
27+
answer+=1;
28+
break;
29+
} else {
30+
answer+=1;
31+
}
32+
dist-=i;
33+
if(dist<=0){
34+
answer+=1;
35+
break;
36+
} else {
37+
answer+=1;
38+
}
39+
i++;
40+
}
41+
return answer;
42+
}
43+
int main(int argc, const char * argv[]) {
44+
int T,x,y;
45+
scanf("%d",&T);
46+
while(T--){
47+
scanf("%d%d",&x,&y);
48+
printf("%d\n",solution(make_pair(x, y)));
49+
}
50+
return 0;
51+
}

0 commit comments

Comments
 (0)