Algospot : ENDIANS

Programming/Judge 2014.12.11 19:50


https://algospot.com/judge/problem/read/ENDIANS


<결과>



<코드>

#include<iostream>
#include<vector>

using namespace std;

int main() {

	int num_edian = 0;
	vector<unsigned int> v;

	cin >> num_edian;

	for (int i = 0; i < num_edian; ++i)
	{
		unsigned int i_temp;
		cin >> i_temp;
		v.push_back(i_temp);
	}

	for (auto i = v.begin(); i != v.end(); ++i)
	{
		unsigned char uc_temp;
		uc_temp = *((unsigned char*)&(*i) + 3);
		*((unsigned char*)&(*i) + 3) = *((unsigned char*)&(*i) + 0);
		*((unsigned char*)&(*i) + 0) = uc_temp;

		uc_temp = *((unsigned char*)&(*i) + 2);
		*((unsigned char*)&(*i) + 2)= *((unsigned char*)&(*i) + 1);
		*((unsigned char*)&(*i) + 1) = uc_temp;

		cout << *i << endl;
	}
}


'Programming > Judge' 카테고리의 다른 글

Algospot : ENCRYPT  (0) 2014.12.15
ACMICPC 1003 : 피보나치 함수  (0) 2014.12.15
ACMICPC 1008 : A/B  (0) 2014.12.15
ACMICPC 1205 : 등수 구하기  (0) 2014.12.13
ACMICPC 1002 : 터렛  (0) 2014.12.12
ACMICPC 1000 : A+B  (0) 2014.12.12
Algospot : LECTURE  (0) 2014.12.12
Algospot : DRAWRECT  (0) 2014.12.11
Algospot : ENDIANS  (0) 2014.12.11
Algospot : MERCY  (0) 2014.12.11
Algospot : Hello World!  (0) 2014.12.11
posted by deviAk