/*#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
long long solution(int w, int h)
{
long long answer = 0;
for(int i=1; i<w; i++)
{
int a=(int)((double)h/w*i);
printf("%d ", a);
answer +=a;
}
return answer*2;
}
int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("%lld", solution(a, b));
}
*/
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
// prices_len은 배열 prices의 길이입니다.
int* solution(int prices[], int prices_len)
{
// return 값은 malloc 등 동적 할당을 사용해주세요. 할당 길이는 상황에 맞게 변경해주세요.
int* answer = (int*)malloc(sizeof(int)*prices_len);
for(int i=0; i<prices_len; i++)
{
int k=0;
for(int j=1; j<prices_len-i; j++)
{
k+=1;
if(prices[i]>prices[j])
{
//answer[i]=k;
break;
}
}
answer[i]=k;
}
return answer;
}
int main()
{
int price[]= {1, 2, 3, 2, 3};
int *res = solution(price, sizeof(price)/sizeof(int));
for(int i =0; i<5; i++)
{
printf("%d ", res[i]);
}
}
자바
//
//import java.util.*;
//
//
//class Person{
// private int age;
//
// public int getAge() {
// return age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//}
//
//public class Main {
// public static void main(String[] args) {
// Person aPerson = new Person();
// aPerson.age = 17;
// }
//
//}
import java.util.*;
class Power{
public int kick;
public int punch;
Power()
{
}
Power(int kick, int punch)
{
this.kick = kick;
}
}
public class Main{
public static void main(String[] args) {
Power robot = new Power();
robot.kick = 16;
robot.punch = 20;
}
}